Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error compiling project when using CfromScript
#1
I am trying to develop the kinematics of an hexapod in the CfromScript (usrcode.c).

When I try to compile the project, I am getting various errors of "multiple definitions" regarding native functions of PowerPMAC IDE (e.g: GetEnumPtrVar / GetEnumPtrArrayVar), pointing to lines in "pp_proj.h" file, but called from different output files: usrcode.o file and one I created called "kin_hexbestec.o" file. The multiple declarations points to the same line, as if the files (and definitions) are considered twice, although the "pp_proj.h" has the "#ifndef _PP_PROJ_H_" macro at the beggining.

After some debug, I realize that the problem is that the functions are implemented in the header file "pp_proj.h", which is automatically created during compilation. Which means that I can't include this file in separate "compilation units" (.o files). The problem is that this is the same header file (pp_proj.h) in which the "global definitions" variables are available for use in C code. How can I use these global variables in different C files without these errors?
Reply
#2
Quote:When I try to compile the project, I am getting various errors of "multiple definitions" regarding native functions of PowerPMAC IDE (e.g: GetEnumPtrVar / GetEnumPtrArrayVar), pointing to lines in "pp_proj.h" file, but called from different output files: usrcode.o file and one I created called "kin_hexbestec.o" file. The multiple declarations points to the same line, as if the files (and definitions) are considered twice, although the "pp_proj.h" has the "#ifndef _PP_PROJ_H_" macro at the beggining.
Did you try to edit "pp_proj.h"? This file is maintained by the IDE.

Did you edit pp_proj.h? This file should be left alone and managed by the IDE. Your kinematics should not be in a .o file. Any c code in the project should be compiled at the build and download step. If you're looking for a place to put kinematic functions I recommend adding a .h file within the include folder and including it in usercode.c.
Code:
#include "../Include/Kinematic_Functions.h"

Quote:After some debug, I realize that the problem is that the functions are implemented in the header file "pp_proj.h", which is automatically created during compilation. Which means that I can't include this file in separate "compilation units" (.o files). The problem is that this is the same header file (pp_proj.h) in which the "global definitions" variables are available for use in C code. How can I use these global variables in different C files without these errors?

You should be able to access any global variables declared in script by their script variable name. (This is in enum mode which is default, if you change the comments at the top of a c code file you can go into a mode that works differently.)

Is this what you meant or did I misunderstand something?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)