$ gcc -Wall -g -std=c++0x -pthread Trial.cpp
gcc: unrecognized option '-pthread'
Trial.cpp: In function `int main()':
Trial.cpp:21:5: error: `thread' was not declared in this scope
Trial.cpp:21:12: error: expected `;' before `t'
Trial.cpp:22:5: error: `t' was not declared in this scope
Can anybody tell me if there is any option I missed to enable thread support?
Last edited by rohshall; August 23rd, 2010 at 02:59 AM.
According to this page: http://gcc.gnu.org/projects/cxx0x.html
it looks like the gcc support for concurrency is still fairly minimal. I don't think that page covers what's been done with the gcc standard library though.
I have read a couple of other blogs using gcc with this feature. So, I think I am just making some mistake in configuring the gcc. Unfortunately the gcc binaries that are available for cygwin are old. So, I need to compile from source.
"-pthread" should be a synonym for "-pthreads". Try it with an s on the end.
I tried it, but that option is also not recognized. I am aware that pthreads is a separate library and I can link using -lpthreads, but this C++0x thread is library separate from the pthreads though it is just a wrapper on that on Posix systems.