I wanted to try out the new std::thread in C++11 in Code Blocks and I'm not sure if I'm doing it right.
This is the code:
#include <iostream>
#include <thread>
void foo()
{
std::cout << "\n thread started. \n";
}
int main()
{
std::cout << "starting thread";
std::thread thr1(foo);
std::cout << "waiting for thread to finish\n";
thr1.join();
std::cout << "done!\n";
return 0;
}
At first I got some kind of warning that I had to use a compiler flag (-std=c++11), so I did.
And now I get 'thread is not a member of std'
I'm using GNU GCC compiler on windows 7. What should I do?