gcc 4.7.1 doesn't support threads?

when i try to compile my code with gcc -std=c++11 *.cpp -o main
it gives me an error: "thread is not a member of std"

my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <thread>
using std::cout;
using std::endl;

void t1func()
{
	cout << "from t1" << endl;
}


int main()
{
	std::thread t1(t1func);
	
	t1.join();
	
	
	
	
	
	return 0;
}


what am i doing wrong?
Last edited on
GCC 4.7.1 is four years old.

On Linux, thread support needed to be enabled with the -pthread link option. If using the MinGW port, I think threads were simply unsupported.
so ill just have to get another compiler then?
C++ has come a very long way in the last four years.
Topic archived. No new replies allowed.