无法打开包含文件“线程" [英] Cannot open include file 'thread'
问题描述
我正在尝试在 C++ 程序中为并行循环使用线程函数,但我无法include <thread>
,它一直给我错误
I'm trying to use a threaded function for a parallel loop in a C++ program but I can't include <thread>
, it keeps giving me the error
fatal error C1083: Cannot open include file: 'thread': No such file or directory
我正在运行 Visual Studio 2010 express、x64(带有 x64 编译器选项)并且我相信我正在运行所有东西的最新版本(Windows SDK 7.1)但是我在编译器的道具页面中找不到选项版本.(我发现最接近的是设置为 v100 的平台工具集)
I'm running visual studio 2010 express, x64 (with x64 compiler options) and I believe I'm running the newest version of everything (Windows SDK 7.1) but I can't find an option in the props page for compiler version. (closest i found was Platform Toolset which is set to v100)
推荐答案
您的编译器不支持 C++11,因此您需要升级/更改编译器.似乎 VS2012 支持它:http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx.
Your compiler does not support C++11, so you need to upgrade/change the compiler. It seems that VS2012 supports it: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx.
至于 C++11 标准库,我们没有一个漂亮的特性表,但是 Visual Studio 2012 中的 Visual C++ 确实实现了它(...)新标头:atomic、chrono、condition_variable、future、mutex、ratio、scoped_allocator 和 thread.
As for the C++11 Standard Library, we don't have a pretty table of features, but Visual C++ in Visual Studio 2012 does implement it (...) New headers: atomic, chrono, condition_variable, future, mutex, ratio, scoped_allocator, and thread.
关于 C++11 支持的更多链接:
Few more links about C++11 support:
http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=118165827
这篇关于无法打开包含文件“线程"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!