Communication with GCC ends after switching version from 1.52 to 1.53

After upgrading formatting libraries from 1.52 to 1.53, I get the following linker error when building with GCC on Linux. The same app builds fine under Windows with VC ++ 10 and level up 1.53.

Invoking: GCC C++ Linker
g++ -L"/home/robert/boost_1_53_0/stage/lib" -L/usr/lib -o "MyApp"  ./myObjectFile.o -lboost_log_setup-mt-s -lboost_log-mt-s -lboost_thread-mt-s -lboost_system-mt-s -lboost_regex-mt-s -lcryptopp -lboost_date_time-mt-s -lpthread -ldl -lboost_filesystem-mt-s
/home/robert/boost_1_53_0/stage/lib/libboost_thread-mt-s.a(thread.o): In function `boost::this_thread::hiden::sleep_for(timespec const&)':
thread.cpp:(.text+0xc10): undefined reference to `clock_gettime'
/home/robert/boost_1_53_0/stage/lib/libboost_thread-mt-s.a(thread.o): In function `boost::this_thread::hiden::sleep_until(timespec const&)':
thread.cpp:(.text+0x1425): undefined reference to `clock_gettime'
thread.cpp:(.text+0x14cd): undefined reference to `clock_gettime'
thread.cpp:(.text+0x159c): undefined reference to `clock_gettime'
thread.cpp:(.text+0x1684): undefined reference to `clock_gettime'
/home/robert/boost_1_53_0/stage/lib/libboost_thread-mt-s.a(thread.o):thread.cpp:(.text+0x176e): more undefined references to `clock_gettime' follow
collect2: error: ld returned 1 exit status

      

I have built boost libraries like this:

./bootstrap.sh --with-toolset=gcc
./b2 --layout=tagged variant=debug,release link=static runtime-link=static cxxflags=-std=c++0x

      

My GCC version is 4.7.2

+3


source to share


1 answer


It basically says that the function was clock_gettime

not found by the linker. This function is in the library rt

, so add -lrt

to the linker command line.



+3


source







All Articles