Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Is it possible for preprocessor to check if a linker option is used?

$
0
0

I have a timer program which uses clock_gettime. This requires -lpthread option to compile successfully or else it gets undefined reference to 'clock_gettime' error.

As so far I explored that we can generate preprocessor warning messages with #warning and check if the include is present by #if __has_include("<pthread.h>"). But checking those does not really check if clock_gettime function is defined.

Just curious if I can make a custom message to warn people at compile time or preprocessing time who compiled without it to include -lpthread option.

I am using MinGW on Windows.


Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>