如何在Mac OS X上使用clang获得新的C ++线程支持? [英] How do I get the new C++ threading support on Mac OS X with clang?
本文介绍了如何在Mac OS X上使用clang获得新的C ++线程支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想使用Apple clang 4.1版(标签/ Apple / clang-421.11.66)在Mac OSX 10.8上编译以下程序:
#include< thread>
using namespace std;
int main(){
cout<< 你好,世界;
}
但我得到:
../ src / FirstCAgain.cpp:13:10:fatal error:'thread'file not found
#include< thread>
我启用了c ++ 11支持,我使用Eclipse C / C ++开发工具。 / p>
问题是:如何在Mac OS X上获得新的C ++线程支持?
解决方案
您需要使用新的 libc ++
,这不是默认值:
clang ++ -stdlib = libc ++ threadtest.cpp
也需要包括iostream,但我认为这不是你的困惑。)
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):
#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.
The question is: How do I get the new C++ threading support on Mac OS X ?
解决方案
You need to use the new libc++
, which isn't the default:
clang++ -stdlib=libc++ threadtest.cpp
(Of course you also need to include iostream, but I assume that wasn't you confusion.)
这篇关于如何在Mac OS X上使用clang获得新的C ++线程支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文