I'm using Visual Studio 2012.
I used many times preprocessor directives like
#ifdef something
#include<some_header.h>
#else
#include<other_header.h>
#endif
I was wondering if is possible to link a static library in a similar way:
#ifdef something
// use some_library.lib
#else
// use other_library.lib
#endif
The question, came from the subject of my previous question: I have two static libraries lib1.lib, lib2.lib (not their code) without namespaces, with the same function-prototypes, but with different implementations.
If you are using MSVC you can do
#ifdef something
#pragma comment(lib,"xxx.lib")
#else
#pragma comment(lib,"zzz.lib")
#endif
In GCC you cannot do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With