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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.