|
From: Aleksey Y. <ale...@gm...> - 2014-01-16 22:20:29
|
Hello, I've just installed MinGW Ver 4.8.1 on my Windows XP laptop, hoping
to play with C++11 threads, but got an error message:
g++ -g -std=c++11 tc001.cpp -o latest
tc001.cpp: In function 'int main()':
tc001.cpp:24:3: error: 'thread' is not a member of 'std'
std::thread t(f);
^
tc001.cpp:24:15: error: expected ';' before 't'
std::thread t(f);
^
tc001.cpp:25:3: error: 't' was not declared in this scope
t.join();
^
make.exe": *** [tc001] Error 1
----------------------------------- My source code:
#include <iostream>
#include <thread>
using std::cout;
using std::endl;
void f()
{
cout << "Hello!" << endl;
}
int main()
{
std::thread t(f);
t.join();
}
--------------------------------- My makefile:
MAIN = tc001
CFLAGS += -g -std=c++11
CC = g++
.SUFFIXES: .o .c .cpp
.c: ;${CC} ${CFLAGS} ${LDFLAGS} $< -o latest ${LDLIBS}
.cpp: ;${CC} ${CFLAGS} ${LDFLAGS} $< -o latest ${LDLIBS}
.c.o: ;${CC} ${CFLAGS} -c $<
.cpp.o: ;${CC} ${CFLAGS} -c $<
build: ${MAIN}
clean:; rm -fr core *.o latest.exe
---------------------------------
What might be wrong? Does 4.8.1 support std::thread? I can see the "thread"
include file in the MInGW tree...
Please help,
Thanks,
~AY
|