Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined reference to `boost::this_thread::interruption_point()'

Tags:

c++

boost

I am trying to compile a project using boost and rtmidi. However I keep getting the following compilation error. I am using linux, netbeans 7.2, boost 1.50.0 and rtmidi 2.1.0.

g++ -D__LINUX_ALSA__ -lasound -lpthread 
-I/usr/local/boost_1_50_0 
-L/usr/local/boost_1_50_0/lib -L/usr/local/lib -L/usr/lib 
-lboost_system    
-o dist/Debug/GNU-Linux-x86/realtimebeatgenerationthesis build/Debug/GNU-Linux-x86/State.o build/Debug/GNU-Linux-x86/RawNote.o build/Debug/GNU-Linux-x86/MarkovEngineConsumer.o build/Debug/GNU-Linux-x86/Calibrator.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/MidiHandlerProducer.o build/Debug/GNU-Linux-x86/LetterPattern.o build/Debug/GNU-Linux-x86/Letter.o build/Debug/GNU-Linux-x86/Meter.o build/Debug/GNU-Linux-x86/VOMC.o build/Debug/GNU-Linux-x86/Metronome.o  

Two parts of the error message that I get are:

undefined reference to `boost::this_thread::interruption_point()'

and

undefined reference to `RtMidiOut::RtMidiOut(RtMidi::Api, std::string)'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/realtimebeatgenerationthesis] Error 1
make[2]: Leaving directory `dir/NetBeansProjects/RealTimeBeat'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `dir/NetBeansProjects/RealTimeBeat'
make: *** [.build-impl] Error 2

EDIT-1: Hey @mathematician1975, even by adding that one I get:

undefined reference to `boost::this_thread::interruption_point()'
build/Debug/GNU-Linux-x86/MarkovEngineConsumer.o: In function     `__static_initialization_and_destruction_0':
/usr/local/boost_1_50_0/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/local/boost_1_50_0/boost/system/error_code.hpp:215: undefined reference to  `boost::system::generic_category()'
/usr/local/boost_1_50_0/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'

Finally I finally made it work by adding through linker->add library boost_thread boost_system and rtmidi. Leading to something similar to the following in the command line :

g++ -Wall -D__LINUX_ALSA__ -I/usr/local -L/usr/local/lib/ -L/alsa/ -lasound -lpthread -o          build/Debug/GNU-Linux-x86/Calibrator.o ..../main.o ...../MidiHandlerProducer.o ...../LetterPattern.o ..../Letter.o ..../Meter.o ..../VOMC.o ..../Metronome.o -L/usr/local/lib -lboost_thread -lboost_system -lrtmidi 
like image 659
Potney Switters Avatar asked Dec 21 '22 17:12

Potney Switters


1 Answers

You dont seem to be linking to the boost thread library. Try adding -lboost_thread in your build path.

like image 71
mathematician1975 Avatar answered Dec 24 '22 01:12

mathematician1975