[英]error: 'std::this_thread' has not been declared
I try to use std::this_thread::sleep_for() function but got the error 我尝试使用std :: this_thread :: sleep_for()函数,但得到了错误
error: 'std::this_thread' has not been declared
. error: 'std::this_thread' has not been declared
。
The flag _GLIBCXX_USE_NANOSLEEP included. 标志_GLIBCXX_USE_NANOSLEEP包括在内。
What else is needed to force it to work? 还需要什么来强迫它发挥作用?
MinGW ==> gcc version 4.7.2 (GCC) MinGW ==> gcc版本4.7.2(GCC)
SSCCE: SSCCE:
#include<thread>
int main() {
std::this_thread::sleep_for(std::chrono::seconds(3));
}
command line: 命令行:
g++ -D_GLIBCXX_USE_NANOSLEEP -std=gnu++0x ssce.cpp -o ssce.exe
result of compilation: 编译结果:
ssce.cpp: In function 'int main()':
ssce.cpp:4:8: error: 'std::this_thread' has not been declared
Use MinGW with POSIX threads, Luke. 使用MinGW和POSIX线程,Luke。
http://sourceforge.net/projects/mingwbuilds/ http://sourceforge.net/projects/mingwbuilds/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.