On Sun, May 22, 2011 at 10:06 PM, eric lin <ericlin@xxxxxxxxxxxxx> wrote: > Dear Jonathan and/or g++ with boost programer/users: > > I tried apt-get install libboost-dev > on my ubuntu linux system > but when I tried to compile/link > ----------- > eric@eric-laptop:~/cppcookbook$ g++ example12-1.cpp > /tmp/cchm8bWZ.o: In function `main': > example12-1.cpp:(.text+0x30): undefined reference to `boost::thread::join()' > example12-1.cpp:(.text+0x3c): undefined reference to `boost::thread::~thread()' > example12-1.cpp:(.text+0x5a): undefined reference to `boost::thread::~thread()' > /tmp/cchm8bWZ.o: In function `boost::detail::thread_data_base::thread_data_base()': > example12-1.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[boost::detail::thread_data_base::thread_data_base()]+0x1b): undefined reference to `vtable for boost::detail::thread_data_base' > /tmp/cchm8bWZ.o: In function `boost::thread::yield()': > example12-1.cpp:(.text._ZN5boost6thread5yieldEv[boost::thread::yield()]+0x7): undefined reference to `boost::this_thread::yield()' > /tmp/cchm8bWZ.o: In function `boost::thread::thread<MyThreadFunc>(MyThreadFunc, boost::disable_if<boost::is_convertible<MyThreadFunc&, boost::detail::thread_move_t<MyThreadFunc> >, boost::thread::dummy*>::type)': > example12-1.cpp:(.text._ZN5boost6threadC1I12MyThreadFuncEET_NS_10disable_ifINS_14is_convertibleIRS3_NS_6detail13thread_move_tIS3_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<MyThreadFunc>(MyThreadFunc, boost::disable_if<boost::is_convertible<MyThreadFunc&, boost::detail::thread_move_t<MyThreadFunc> >, boost::thread::dummy*>::type)]+0x21): undefined reference to `boost::thread::start_thread()' > /tmp/cchm8bWZ.o: In function `boost::detail::thread_data<MyThreadFunc>::~thread_data()': > example12-1.cpp:(.text._ZN5boost6detail11thread_dataI12MyThreadFuncED1Ev[boost::detail::thread_data<MyThreadFunc>::~thread_data()]+0x16): undefined reference to `boost::detail::thread_data_base::~thread_data_base()' > /tmp/cchm8bWZ.o: In function `boost::detail::thread_data<MyThreadFunc>::~thread_data()': > example12-1.cpp:(.text._ZN5boost6detail11thread_dataI12MyThreadFuncED0Ev[boost::detail::thread_data<MyThreadFunc>::~thread_data()]+0x16): undefined reference to `boost::detail::thread_data_base::~thread_data_base()' > /tmp/cchm8bWZ.o:(.rodata._ZTIN5boost6detail11thread_dataI12MyThreadFuncEE[typeinfo for boost::detail::thread_data<MyThreadFunc>]+0x8): undefined reference to `typeinfo for boost::detail::thread_data_base' > collect2: ld returned 1 exit status > eric@eric-laptop:~/cppcookbook$ > --------------------------------- > actually I also tried to install that boost lib follow its install instuction > , after that(maybe not fully success, I am not sure) > I found there is > libboost_thread.so > -------- > root@eric-laptop:/home/eric/boost1/boost_1_46_1# ls -l -a /usr/local/lib/libboost_thread.so > lrwxrwxrwx 1 root root 25 2011-05-22 18:38 /usr/local/lib/libboost_thread.so -> libboost_thread.so.1.46.1 > root@eric-laptop:/home/eric/boost1/boost_1_46_1# ls -l -a /usr/local/lib/libboost_thread.so.1.46.1 > -rwxr-xr-x 1 root root 123301 2011-05-22 18:38 /usr/local/lib/libboost_thread.so.1.46.1 > > -------------- > > hope these help any advencer to debug to make it success to compile/link > thanks a lot in advance, Eric > > I found there is > libboost_thread.so g++ example12-1.cpp -lboost_thread It it does not link, issue the following to see if the library is available to the runtime linker ldconfig -p | grep -i boost Jeff