This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

using #ifdef in library files --- how to use a #define in application code to include??



I have two projects.  Each project contains a header file and a c file.  Project 1 is a library.  Project 2 is the application with main.  I would like to place a #ifdef around all the code in the library project, compile it and link it to the main project.  Then in the header file of the main project the user can place a #define which would allow access to the library.  It seems however that once the library is compiled with the #ifdef in place that is the code you get without any of the functionality of the library.  Can someone explain to me how to go about doing what I want to do?  

I would like to offer the library to the user and then in their application code header file they create a symbol which "opens up access" to the library.....Maybe this isn't doable.  I am certainly aware that they could just not include it within the linker library section but I was wondering if there was a way to do it with a #define.

Thanks

**Attention** This is a public forum