Search code examples
c++includeautotools

check if a library is present


Suppose I want to include a library:

#include <library.h>

but I'm not sure it's installed in the system. The usual way is to use tool like autotools. Is there a simpler way in C++? For example in python you can handle it with exceptions.


Solution

  • autotools is the best way to detect at compile time. It's very platform-specific, but assuming you're on Linux or similar, dlopen is how you check at runtime.