M
mangesh sawant
Hi,
I am trying to compile following code using gcc version "g++ (GCC)
4.3.4 20090804 (release) 1" on cygwin
------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <thread>
using namespace std;
void hello()
{
cout << "Hello Concurrent World!" << endl;
}
int main()
{
cout << "starting" << endl;
thread t(hello);
t.join();
cout << "ending" << endl;
return 0;
}
------------------------------------------------------------------------------------------
When i try to compile this like :
g++ -D_POSIX_TIMEOUTS -D_GLIBCXX__PTHREADS -D_GLIBCXX_HAS_GTHREADS -
enable-auto-import -std=c++0x sample.cpp --lpthread
I get folowing error :
sample.cpp:2:18: error: thread: No such file or directory
sample.cpp: In function `int main()':
sample.cpp:13: error: `thread' was not declared in this scope
sample.cpp:13: error: expected `;' before `t'
sample.cpp:14: error: `t' was not declared in this scope
Can anyone help with this?? Do I need to have a higher version of
gcc??
I am trying to compile following code using gcc version "g++ (GCC)
4.3.4 20090804 (release) 1" on cygwin
------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <thread>
using namespace std;
void hello()
{
cout << "Hello Concurrent World!" << endl;
}
int main()
{
cout << "starting" << endl;
thread t(hello);
t.join();
cout << "ending" << endl;
return 0;
}
------------------------------------------------------------------------------------------
When i try to compile this like :
g++ -D_POSIX_TIMEOUTS -D_GLIBCXX__PTHREADS -D_GLIBCXX_HAS_GTHREADS -
enable-auto-import -std=c++0x sample.cpp --lpthread
I get folowing error :
sample.cpp:2:18: error: thread: No such file or directory
sample.cpp: In function `int main()':
sample.cpp:13: error: `thread' was not declared in this scope
sample.cpp:13: error: expected `;' before `t'
sample.cpp:14: error: `t' was not declared in this scope
Can anyone help with this?? Do I need to have a higher version of
gcc??