This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: program using std::thread terminated abnormally
- From: Miles Bader <miles at gnu dot org>
- To: shengli li <goodhorce at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 05 Oct 2010 17:09:43 +0900
- Subject: Re: program using std::thread terminated abnormally
- References: <AANLkTikrzsFePP8j_KVJtfcMe-oykfA3enbMddFzNbk+@mail.gmail.com> <AANLkTikd0nNEnmXXYTEmtLDBJicN3=Y_-yCZDz0EsUBo@mail.gmail.com>
- Reply-to: Miles Bader <miles at gnu dot org>
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'