升级后我收到以下错误.我无法弄清楚它有什么问题.它应该尽我所能.
$make 2>&1 | head g++ -o prog -ansi -O2 -Wall -I/usr/include/boost -L/usr/lib -lboost_program_options -lboost_thread -lstdc++ ./YYY.o ./main.o ./myClass.o ./YYY.o: In function `void boost::call_once<void (*)()>(boost::once_flag&,void (*)())': YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0x14): undefined reference to `boost::detail::get_once_per_thread_epoch()' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0x2c): undefined reference to `boost::detail::once_epoch_mutex' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0x62): undefined reference to `boost::detail::once_epoch_mutex' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0x67): undefined reference to `boost::detail::once_epoch_cv' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0x95): undefined reference to `boost::detail::once_epoch_mutex' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0xa9): undefined reference to `boost::detail::once_epoch_mutex' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0xbd): undefined reference to `boost::detail::once_global_epoch' YYY.cc:(.text._ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_[void boost::call_once<void (*)()>(boost::once_flag&,void (*)())]+0xc2): undefined reference to `boost::detail::once_epoch_cv' $ls -l /usr/lib/*boost_threa* 0 lrwxrwxrwx 1 root root 17 Jun 3 22:30 /usr/lib/libboost_thread-mt.a -> libboost_thread.a 0 lrwxrwxrwx 1 root root 25 Jun 3 22:30 /usr/lib/libboost_thread-mt.so -> libboost_thread.so.1.46.1 208K -rw-r--r-- 1 root root 208K Jun 3 22:30 /usr/lib/libboost_thread.a 0 lrwxrwxrwx 1 root root 25 Jun 3 22:30 /usr/lib/libboost_thread.so -> libboost_thread.so.1.46.1 88K -rw-r--r-- 1 root root 87K Oct 21 2010 /usr/lib/libboost_thread.so.1.42.0 100K -rw-r--r-- 1 root root 99K Jun 3 22:30 /usr/lib/libboost_thread.so.1.46.1 $ls -ld /usr/include/boost/*thread* 4.0K drwxr-xr-x 5 root root 4.0K Oct 13 21:59 /usr/include/boost/thread/ 4.0K -rw-r--r-- 1 root root 839 Jun 3 22:18 /usr/include/boost/thread.hpp
解决方案涉及根据手册页更改链接顺序.事情是它曾经与旧版本的g …
$make g++ -I/usr/include/boost -MM ./YYY.cc ./main.cc ./myClass.cc > buildfiles.d g++ -ansi -O2 -Wall -I/usr/include/boost -c -o main.o main.cc g++ -ansi -O2 -Wall -I/usr/include/boost -c -o myClass.o myClass.cc g++ -o prog -ansi -O2 -Wall -I/usr/include/boost ./YYY.o ./main.o ./myClass.o -lstdc++ -L/usr/lib -lboost_program_options -lboost_thread