Good afternoon, tell me, please, how to enable the boost library in netbeans (OS Ubuntu 10.10). I downloaded libboost1.42-dev, libboost1.42-all-dev from repositories, satisfied a bunch of dependencies. In the netbeans itself indicated the path to the library. But when compiling produces an error

build/Debug/GNU-Linux-x86/main.o: In function 'main': /home/egor/NetBeansProjects/boost/main.cpp:16: undefined reference to 'boost::thread::join()' 

etc. for each method.

  • What is the compilation line? - dzhioev
  • g ++ - 4.5 -o dist / Debug / GNU-Linux-x86 / boost build / Debug / GNU-Linux-x86 / main.o build / Debug / GNU-Linux-x86 / main.o: In function main': /home/egor/NetBeansProjects/boost/main.cpp:16: undefined reference to boost :: thread :: join () /home/egor/NetBeansProjects/boost/main.cpp:14: undefined reference to `boost :: thread: : ~ thread () ', etc. - Egor Sokolov
  • It seems that you have incorrectly configured something. I never worked in netbeans, so I don’t know how to do it, but the compiler should have the option -lboost-thread. Maybe you can add it directly to the compiler options. - dzhioev
  • Maybe it's in the library from the repository: there are two options for libboost1.42-dbg and 40. Installed 42. - Egor Sokolov
  • one
    In any case, there is libboost_thread.so in the dev package. I confused need to add -lboost_thread - dzhioev

2 answers 2

Project properties, linker, libraries (there is a button with ... click) in the window that appears: Add library (on the right) and add the .a or .so library, usually in / usr / lib /

  • I have already added the library myself a long time ago - Egor Sokolov
  • but what about incl: <boost / thread / thread.hpp> is there? - Alex Kapustin
  • there is - Egor Sokolov

No need to specify a path. Just add -lboost_thread to the linker options. alt text