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.