There is a #define that I need in both of my source files. How do I do this without getting a duplicate error?
Do I include the .h file into the .c file of the same name?
There is a #define that I need in both of my source files. How do I do this without getting a duplicate error?
Do I include the .h file into the .c file of the same name?
Just define it in the .h and include the header in the source file.
Also:
You can include that as many times as you want.Code:#ifndef BOBO #define BOBO "barfoo" #endif
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
It shouldn't matter. Your header shouldn't have anything in it that makes it not be able to be included in different .c files in the same project. I mean, you can include stdio.h in each of your .c files without it complaining ... why should yours behave any differently?
Quzah.
Hope is the first step on the road to disappointment.