Hi,
First off let me say that I'm completely new to the Arduino family and am loving it so far I'm having a problem with a custom library not compiling on a Arduino Sketch. I have a bunch of #defines and enums in a header file and have a few includes at the end of the header file. these definitions and enums are not being recognized by the compiler and am getting a bunch of undefined errors on the includes. I though about just including the definitions on the .c files but a few of them use the same definition and that will cause some more errors. what am I doing wrong?
Hi Nick,
Thanks for the reply, I will go through link and see if I can fix the problem I'm having. but I'm sorry I'm not sure what you mean by code Tags. but this is one of the errors I'm receiving:
C:\arduino-1.0.1\libraries\ballistics_solve.c: In function 'SolveAll':
C:\arduino-1.0.1\libraries\ballistics_solve.c:5: error: 'GRAVITY' undeclared (first use in this function)
C:\arduino-1.0.1\libraries\ballistics_solve.c:5: error: (Each undeclared identifier is reported only once
C:\arduino-1.0.1\libraries\ballistics_solve.c:5: error: for each function it appears in.)
I hope that helps. Please let me know if there was anything else that I forgot to include.
Before you go too far down the path of creating a library using c files, keep in mind that the Arduino is programmed in C++. Using cpp files, even if they contain only C code makes using that code much easier.
c files can be used, but the calling convention for c functions is different than for c++ functions, so you'll have a lot of work to do to make your c functions usable to the Arduino sketch, which uses cpp calling conventions.