I’m trying to run a simulation where I have a C-script block, and I want to include a “.h” file containing only function prototypes.
Here’s a small setup showing this problem.
On the same folder as the simulation file, I have a “controller.h” file and a “controller.c” file. The “controller.h” file only contains the prototype for a function called “control”. The function itself is defined in the “controller.c” file.
In my C-script block, I call the “control” function. The simulation works when I include the “controller.c” file in the C-script “Code Declarations” section, but it does not work if I include the “controller.h” file, the header file containing the function’s prototype. In this case, I get an error telling me that the function “control” is undefined.
What I am missing?
I have attached a simple simulation example and the header and source files.
ptest.plecs (10.6 KB)
controller.h (34 Bytes)
controller.c (134 Bytes)