program using std::thread terminated abnormally

Miles Bader miles@gnu.org
Tue Oct 5 08:10:00 GMT 2010


shengli li <goodhorce@gmail.com> writes:
>     I compiled GCC 4.5.1 on on SUSE linux, but my program which use
> std::thread cannot run. I checked GCC help pages and configured GCC
> with --enable-threads. How can I solve this?
> linux-roger:/home/lishli/cpp # g++ -std=c++0x 1.cpp
..
> linux-roger:/home/lishli/cpp # ./a.out
> terminate called after throwing an instance of 'std::system_error'
>   what():
> Aborted

Try the g++ "-pthread" option:

   $ g++-4.5 -std=c++0x 1.cpp
   $ ./a.out
   terminate called after throwing an instance of 'std::system_error'
     what():  
   Aborted
   $ g++-4.5 -std=c++0x -pthread 1.cpp
   $ ./a.out
   $

-miles

-- 
`The suburb is an obsolete and contradictory form of human settlement'



More information about the Gcc-help mailing list