Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am getting the following problems. I am sure it is a package that was not install/upgraded properly, I am not sure which one:

$ make
g++ -I/usr/include/boost -MM ./YYY.cc ./main.cc ./myClass.cc > buildfiles.d
g++ -Wno-deprecated -Wall -ansi -O2 -I/usr/include/boost   -c -o YYY.o YYY.cc
g++ -Wno-deprecated -Wall -ansi -O2 -I/usr/include/boost   -c -o main.o main.cc
g++ -Wno-deprecated -Wall -ansi -O2 -I/usr/include/boost   -c -o myClass.o myClass.cc
g++ -o prog -Wno-deprecated -Wall -ansi -O2 -I/usr/include/boost -L/usr/lib -lstdc++ -lboost_program_options -lboost_thread ./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'
[...]

Just top be clear, the headers are installed and included in the .h files.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The solution involved changing the order of linkage, as per the man page. The thing is that it used to work fine with an older version of 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 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.