David wrote: > I have a bunch of .c/.h files which make up libraries for different=20 > devices. So in my main code, I can #include "widgit.h". >=20 > To allow changing pins around easily I #define WIDGIT_OUT LATC1 in the=20 > header file. Right now I just include copies of the .c/.h in the=20 > project and modify the widgit header file to move pins. >=20 > I am trying to get to a point where I can store all libraries in one=20 > folder and change pins in my main code. This allows easier source=20 > control and sharing of libraries between projects. >=20 > I thought this should work: >=20 > // In main.c > #define WIDGIT_OUT LATC1 > #include "widgit.h" >=20 > // In widgit.h > #ifndef WIDGIT_OUT > #warning Output pin not defined! > #endif > /* #define WIDGIT_OUT LATC1 <-- Now in main.c */ >=20 > But it appears that this doesn't work. I get errors from widgit.c about= =20 > WIDGIT_OUT being an undefined identifier, using #ifndef/#warning in=20 > widgit.h also prints the message. >=20 > So I'd like to know if: >=20 > 1) The above should work, but I'm doing something wrong. >=20 > 2) What ways people use to write reusable code. That works for compiling main.c (or at least it should), but when you compi= le widgit.c, the symbol won't be defined. You need to put the symbol definitio= n in another header file that gets included for both compiles. -- Dave Tweed --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .