Error while linking program to boost thread library -



Error while linking program to boost thread library -

i had build boost library threading. gave command

./bootstrap.sh

in boost_1_46_1 directory.

bjam --toolset=gcc --build-type=complete --with-thread link=static stage

when tried compile simple programme involving threads, using command below, errors.

g++ -i/home/sharatds/downloads/boost_1_46_1 /home/sharatds/downloads/boost_1_46_1/stage/lib/libboost_thread.a main.cpp -o ini main.cpp:(.text+0x804): undefined reference `boost::thread::join()' main.cpp:(.text+0x9ec): undefined reference `boost::thread::~thread()'

am missing ?

i think build command malformed. explicitly listing archive library in unusual way, , think gcc ignoring or misinterpreting it.

try separating build 2 steps. 1 step compile .cpp file .o, , link .o boost_thread archive library , emit executable.

g++ -i/home/sharatds/downloads/boost_1_46_1 main.cpp -o main.o g++ main -o ini -l/home/sharatds/downloads/boost_1_46_1/stage/lib/ -lboost_thread

the first line above compiles main.cpp object file. sec line links object file boost_thread library. -l argument acts much -i argument, provides search path libraries, rather include files.

also, suspect argument -i should be

-i/home/sharatds/downloads/boost_1_46_1/stage/include

so including headers build results, rather source tree itself. guessing on 1 though.

boost-thread boost-build

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -