[英]mingw 5 std::this_thread not defined
Hi any body try to use header support mingw w64? 嗨,有人尝试使用标头支持mingw w64吗?
main.cpp: In function 'int main()':
main.cpp:9:10: error: 'std::this_thread' has not been declared
std::this_thread::sleep_for( dura );
^
I got above error with following simple test 我通过以下简单测试获得了以上错误
#include <iostream>
#include <chrono>
#include <thread>
int main()
{
std::cout << "Hello waiter" << std::endl;
std::chrono::milliseconds dura( 2000 );
std::this_thread::sleep_for( dura );
std::cout << "Waited 2000 ms\n";
}
I want to use lastest N3653 and N3651 as spesified here https://gcc.gnu.org/projects/cxx1y.html and of course threading support header , using someone builds found here http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/dongsheng-daily/5.0/ and my c++config.h _GLIBCXX_USE_NANOSLEEP is not defined , any idea? 我想使用最新的N3653和N3651作为https://gcc.gnu.org/projects/cxx1y.html ,当然还有线程支持标头,请使用在http://sourceforge.net/projects/mingw- w64 / files / Toolchains%20targetting%20Win64 / Personal%20Builds / dongsheng-daily / 5.0 /和我的c ++ config.h _GLIBCXX_USE_NANOSLEEP未定义,您知道吗?
[EDIT] I realize that my thread model was: win32 and not posix one. [编辑]我意识到我的线程模型是:win32,而不是posix one。 How to enable posix support?
如何启用posix支持?
You can use update-alternatives for i686-w64-mingw-g++
and set it to i686-w64-mingw-g++-posix
from i686-w64-mingw-g++-win32
. 您可以对
i686-w64-mingw-g++
使用更新替代,并将其从i686-w64-mingw-g++-win32
设置为i686-w64-mingw-g++-posix
。
Or you can just use i686-w64-mingw-g++-posix
to compile. 或者,您可以只使用
i686-w64-mingw-g++-posix
进行编译。 There are other versions so in this case you'd use the 64 bit compiler instead and append the -posix
to it. 还有其他版本,因此在这种情况下,您将使用64位编译器,然后将
-posix
附加到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.