« Return to Thread: Post again for help

Post again for help

by Match Point :: Rate this Message:

Reply to Author | View in Thread

 I installed boost library and include files of 1.34 into
/home/qhwang/boost_libs/1.34 several months ago.
I tried a helloword program of thread tutorial today by command:

 g++ -g -I /home/qhwang/boost_libs/1.34/include/ -L
/home/qhwang/boost_libs/1.34/lib/ -lboost_thread-gcc34-mt-1_34_1 -o
helloworld helloworld.cpp

The executable was generated. But after I set LD_LIBRARY_PATH and started
helloword,  there was a segmentation error and a core file was generated.

Program terminated with signal 11, Segmentation fault.
#0  0x00002aaaaaab5477 in boost::thread_group::join_all ()
  from
/home/qhwang/boost_libs/1.34/lib/libboost_thread-gcc34-mt-1_34_1.so.1.34.1
(gdb) bt
#0  0x00002aaaaaab5477 in boost::thread_group::join_all ()
  from
/home/qhwang/boost_libs/1.34/lib/libboost_thread-gcc34-mt-1_34_1.so.1.34.1
#1  0x0000003fdb4062f7 in start_thread () from /lib64/libpthread.so.0
#2  0x0000003fda8ce85d in clone () from /lib64/libc.so.6

What could be the reason?

I tried to install boost 1.35 into /home/qhwang/boost_libs. But when I
compiled the same program

 g++ -I /home/qhwang/boost_libs/include/ -L /home/qhwang/boost_libs/lib/
-lboost_thread-gcc41-mt   -o helloworld helloworld.cpp   and

g++ -I /home/qhwang/boost_libs/include/ -L /home/qhwang/boost_libs/lib/
-lboost_thread-gcc41-mt-1_35   -o helloworld helloworld.cpp

But both of them generated link error:
/tmp/cc2ZKV4R.o: In function `main':
helloworld.cpp:(.text+0x91): undefined reference to
`boost::thread::thread(boost::function0<void,
std::allocator<boost::function_base> > const&)'
collect2: ld returned 1 exit status

What could be reason for this?

My compiler and os is
Linux version 2.6.18-53.1.6.el5 (brewbuilder@hs20-bc1-5.build.redhat.com)
(gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)) #1 SMP Wed Jan 16 03:56:15
EST 2008


Thanks.
Qihong

 « Return to Thread: Post again for help