Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] statically linked example on Linux segfaults when exception is thrown
From: Anthony Williams (anthony_at_[hidden])
Date: 2010-03-23 03:47:36


On 23/03/10 06:08, Neetu Garg wrote:
> Here is how I compile and link the sample
>
> g++ -c -I. -I/usr/local/include/boost-1_38 -I/usr/include testThreadException.cpp -o testThreadException.o
>
> g++ testThreadException.o -static -L/u/test/lib -lboost_program_options-gcc41-mt -lboost_filesystem-gcc41-mt -lboost_thread-gcc41-mt -lboost_system-gcc41-mt -lnet7ssh -lbotan -ltar -lz -lpthread -lrt -o testThreadException

With gcc you often need the "-pthread" option to the compiler to ensure
that it compiles the code in a way that can handle multiple threads. Try
adding "-pthread" to both g++ commands.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk