photon project can't find the external function

in one photon project I add one c source calc.c,it includes some funtion,but when I use the funtion in the c file created by photon, during compiling it said the function couldn’t be found,why?

probably because there is no protoypes for the fonction that the file created by photon can find.

I have declare the function as “extern void a();” in the file created by photon,but it doesn’t work.

When you say “project” are you using the IDE? Which version of the OS. When not using the IDE, in older versions there is text file, indSfiles you can edit. In newer versions the .c file should be compiled and linked in merely by being in the src directory. The ind… files are generated automatically so if it’s there you can use it, and if not, you shouldn’t need to. I’m afraid I don’t know who the IDE deals with this issue.

I have found the reason,I use c++ source ,but the default setting for photon project can’t compile c++ source file,It’ s OK after I change the source to c source file,btw how to compile c++ source for photon project,where should be changed?

I think if your file as .cc extension it’s done automatically

no,.cc file can’t be compiled in photon project,in other word,there’s no error if you don’t use the function that in .cc file,but if you use there will has the error “can’t find function”,but if it is changed to c file,It’s OK.

are you calling them from C files. If so you have to wrap the protoypes with extern “C” { … }.

It’s no use with the prototype extern “C” {…}

the prototypes haves includes from the C and C++ files.