什么是g ++的-pthread相当于clang?

时间:2010-03-06 03:03:26

标签: multithreading gcc g++ pthreads clang

我正在从g ++切换到clang

然而,在g ++中,我有-pthread标志,clang似乎无法识别。

clang中的等价物是什么?

编辑:我的铿锵声在2010年3月5日从svn开始。

2 个答案:

答案 0 :(得分:31)

clang在编译时需要-pthread但在链接时不需要$ clang -c x.cpp $ clang -pthread -c x.cpp $ clang -o x x.o $ clang -pthread -o x x.o clang: warning: argument unused during compilation: '-pthread' $ $ clang --version Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix $ 。这很烦人,但观察到行为:

{{1}}

答案 1 :(得分:10)

Clang supports -pthread。可能是最新版本,因此请更新并重试。