If your "libraries" are indeed ".lib" files, that approach won't work, because the library's code was compiled with a fixed value for the constant macros. You must have access to all source files and compile them all together with your application. Isaac Em 27/8/2012 12:50, David escreveu: > 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". > > 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. > > 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. > > 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= =20 > WIDGIT_OUT being an undefined identifier, using #ifndef/#warning in=20 > 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 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .