[英]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.