【问题标题】:What is g++'s -pthread equiv in clang?什么是g ++的-pthread equiv在clang中?
【发布时间】:2011-01-24 08:58:17
【问题描述】:

我正在从 g++ 切换到 clang

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

clang 中的等价物是什么?

编辑:我的 clang 版本是 2010 年 3 月 5 日从 svn 提取的。

【问题讨论】:

  • 我发布的链接表明clang确实接受-pthread。检查是否还有其他问题。您收到什么错误消息?

标签: multithreading gcc g++ pthreads clang


【解决方案1】:

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

【讨论】:

  • 好像不支持了。
【解决方案2】:

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
$

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-09
    • 2013-02-14
    • 1970-01-01
    • 2020-09-07
    • 2011-08-14
    • 2020-05-19
    • 1970-01-01
    • 2019-05-23
    相关资源
    最近更新 更多