I tried a basic program:
// ThreadExample.cpp
#include <string>
#include <iostream>
#include <thread>
using namespace std;
void task1(string msg)
{
cout << "task1 says: " << msg;
}
int main()
{
thread t1(task1, "Hello");
t1.join();
}
One I actually found on stackoverflow, but I tried compiling it using:
g++ -std=c++0x -pthread ThreadExample.cpp -o ThreadExample -lm
However, I keep getting an error that thread is undeclared. I have version 4.7.1 of the MinGW GNU for Windows. Is there something I can change so I can use C++11?