简体   繁体   English

如何使用clang在Mac OS X上获得新的C ++线程支持?

[英]How do I get the new C++ threading support on Mac OS X with clang?

I just want to compile the following program on Mac OSX 10.8 using Apple clang version 4.1 (tags/Apple/clang-421.11.66): 我只想使用Apple clang 4.1版(标签/ Apple / clang-421.11.66)在Mac OSX 10.8上编译以下程序:

#include <thread>

using namespace std;

int main() {

    cout << "Hello world";

}

But I get: 但我得到:

../src/FirstCAgain.cpp:13:10: fatal error: 'thread' file not found
#include <thread>

I enabled c++11 support and I'm using the Eclipse C/C++ Development Tooling. 我启用了c ++ 11支持,并且我正在使用Eclipse C / C ++ Development Tooling。

The question is: How do I get the new C++ threading support on Mac OS X ? 问题是:如何在Mac OS X上获得新的C ++线程支持?

You need to use the new libc++ , which isn't the default: 您需要使用新的libc++ ,它不是默认值:

clang++ -stdlib=libc++ threadtest.cpp 

(Of course you also need to include iostream, but I assume that wasn't you confusion.) (当然你还需要包含iostream,但我认为这不是你的困惑。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C ++中获得Mac OS X中主显示器的分辨率? - How do I get the resolution of the main monitor in Mac OS X in C++? 在Mac OS X 10.6上使用clang 2.8编译C ++代码时,如何解决缺失的符号? - How can I resolve missing symbols when compiling C++ code with clang 2.8 on Mac OS X 10.6? 如何使用 C/C++ 在 Mac OS X 中获取键盘布局 - How to get keyboard layout in Mac OS X with C/C++ 如何使用Xcode 4.6.2至7.1.1获得对Mac OS X 10.6部署的c ++ 0x / c ++ 11支持 - How do I get back c++0x/c++11 support for Mac OS X 10.6 deployment using Xcode 4.6.2 thru 7.1.1 如何在Mac OS X C ++程序中记录时间戳? - How do I record timestamps in a Mac OS X C++ program? 如何将运行 OS/X El Capitan 的 Mac 上的 clang 升级到 LLVM 3.8? - How do I upgrade the clang on my Mac running OS/X El Capitan to LLVM 3.8? 如何使用C / C ++在OS X中获得分区偏移? - How do I get the partition offset in OS X with C/C++? 使用c ++在Mac OS X上启动“新电子邮件”窗口 - Launch “new email” window on Mac OS X with c++ "Clang C++ 交叉编译器 - 从 Mac OS X 生成 Windows 可执行文件" - Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X 如何使用 Clang/GCC 在 Mac 上为 C/C++ 设置 VSCode? - How do I set up VSCode for C/C++ on Mac with Clang/GCC?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM