我正在从g ++切换到clang
然而,在g ++中,我有-pthread标志,clang似乎无法识别。
clang中的等价物是什么?
编辑:我的铿锵声在2010年3月5日从svn开始。答案 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
。可能是最新版本,因此请更新并重试。