This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Include .lib File

We can add a .lib File to a project by adding the file to a target.
But I have the situation, that I would like to include one .lib File or the other .lib File dependent on how some #defines are set. So I like to specify via source code (between #ifdef ... #else .. #endif) which .lib file I like to link into my project.
How can this be done?
Thanks in advance for your hints. - Adrian

Parents
  • How can this be done?

    It can't. Preprocessor #if's are several layers of tools away from the linker/librarian. There's no way for a decision result to punch through all the way.

    What you can and should do in this case is define multiple targets for your project, then enable only the library you want in each of them. You can also specify different preprocessor definitions.

    The location of the switch affecting both your C source code and the librarian, has to be in the top-level tool that controls all the others.

Reply
  • How can this be done?

    It can't. Preprocessor #if's are several layers of tools away from the linker/librarian. There's no way for a decision result to punch through all the way.

    What you can and should do in this case is define multiple targets for your project, then enable only the library you want in each of them. You can also specify different preprocessor definitions.

    The location of the switch affecting both your C source code and the librarian, has to be in the top-level tool that controls all the others.

Children