My bet would be that widigit.h is inlcuded somewere where you forgot to define that WIDIGIT_OUT prior to the inclusion. This is not necessarily happening within your code, but in another header file you included directly or indirectly in your source files. Tamas On 27 August 2012 08:50, David wrote: > I have a bunch of .c/.h files which make up libraries for different > devices. So in my main code, I can #include "widgit.h". > > To allow changing pins around easily I #define WIDGIT_OUT LATC1 in the > header file. Right now I just include copies of the .c/.h in the > project and modify the widgit header file to move pins. > > I am trying to get to a point where I can store all libraries in one > folder and change pins in my main code. This allows easier source > control and sharing of libraries between projects. > > I thought this should work: > > // In main.c > #define WIDGIT_OUT LATC1 > #include "widgit.h" > > // In widgit.h > #ifndef WIDGIT_OUT > #warning Output pin not defined! > #endif > /* #define WIDGIT_OUT LATC1 <-- Now in main.c */ > > But it appears that this doesn't work. I get errors from widgit.c about > WIDGIT_OUT being an undefined identifier, using #ifndef/#warning in > widgit.h also prints the message. > > So I'd like to know if: > > 1) The above should work, but I'm doing something wrong. > > 2) What ways people use to write reusable code. > > David > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .