Search code examples
gccconditional-compilationlibrt

Check for librt linking


Is there a macro that I can #ifdef for to check if librt has been linked to, ie by -lrt with gcc?


Solution

  • No, gcc doesn't have such macro (I've dumped preprocessor macros to check). On Windows with Microsoft compiler you can use _VC_NODEFAULTLIB macro to detect builds without libc reference.