簡體   English   中英

錯誤:'std :: this_thread'尚未聲明

[英]error: 'std::this_thread' has not been declared

我嘗試使用std :: this_thread :: sleep_for()函數,但得到了錯誤
error: 'std::this_thread' has not been declared
標志_GLIBCXX_USE_NANOSLEEP包括在內。
還需要什么來強迫它發揮作用?
MinGW ==> gcc版本4.7.2(GCC)

SSCCE:

#include<thread>

int main() {
  std::this_thread::sleep_for(std::chrono::seconds(3));
}

命令行:

g++ -D_GLIBCXX_USE_NANOSLEEP -std=gnu++0x ssce.cpp -o ssce.exe

編譯結果:

ssce.cpp: In function 'int main()':
ssce.cpp:4:8: error: 'std::this_thread' has not been declared

使用MinGW和POSIX線程,Luke。

http://sourceforge.net/projects/mingwbuilds/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM