9

我只想使用 Apple clang 4.1 (tags/Apple/clang-421.11.66) 在 Mac OSX 10.8 上编译以下程序:

#include <thread>

using namespace std;

int main() {

    cout << "Hello world";

}

但我得到:

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

我启用了 c++11 支持,并且正在使用 Eclipse C/C++ 开发工具。

问题是:如何在 Mac OS X 上获得新的 C++ 线程支持?

4

1 回答 1

11

您需要使用 new libc++,这不是默认值:

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

(当然,您还需要包含 iostream,但我认为这不是您的困惑。)

于 2013-01-05T22:39:34.613 回答