【问题标题】:Cannot open include file 'thread'无法打开包含文件“线程”
【发布时间】:2013-08-21 20:34:11
【问题描述】:

我正在尝试在 C++ 程序中将线程函数用于并行循环,但我不能include <thread>,它一直给我错误

fatal error C1083: Cannot open include file: 'thread': No such file or directory

我正在运行 Visual Studio 2010 Express、x64(带有 x64 编译器选项),并且我相信我正在运行所有内容的最新版本(Windows SDK 7.1),但我在编译器的道具页面中找不到选项版本。 (我发现最接近的是设置为 v100 的平台工具集)

【问题讨论】:

    标签: c++ multithreading linker include 64-bit


    【解决方案1】:

    您的编译器不支持 C++11,因此您需要升级/更改编译器。看来VS2012支持了: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

    关于 C++11 支持的更多链接:

    http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/

    https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=118165827

    【讨论】:

    • 那么在VS2010中就没有办法使用C++11了吗?
    • 大部分 - 没有。例如,您可以使用boost::thread,但您可能希望升级到 VS2012。
    • @Arhowk VS2010 支持一个不错的 C++11 子集;这是一个方便的compiler support table。 VS 2010 是 MSVC 10.0
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-10
    • 2016-06-17
    • 2019-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多