I am compiling a C++ project on Ubuntu 12.04 and I get a linking error stating
undefined reference to `clock_gettime@GLIBC_2.17'
undefined reference to `clock_getres@GLIBC_2.17'
I read a lot of threads about this issue and I tried all the usual solutions (separately). Such as adding the -lrt
flag to the g++
command line (I tried in the beginning and in the end), setting the cmake linker flags variables to -lrt
, adding the librt.so location to the link_directories
variable or even to the target_link_libraries
. None of this worked.
When I run ldd --version
I get
ldd (Ubuntu EGLIBC 2.15-0ubuntu10.12) 2.15
And for what I understood from research this is the last glibc version for Ubuntu 12.04. But the error references to glibc 2.17... So My question is: Am I getting this error because of the gclib version? Is there any way I can get a more recent version for Ubuntu 12.04?
Thank you in advance!