c – OS X clang -pthread

c – OS X clang -pthread,第1张

概述在OS X中使用带有clang的pthread库有什么编译器/链接器要求. 使用GCC我知道使用-pthread设置适当的编译器/链接器选项,但我不确定OS X与clang. air:~ jose$clang++ -c test.cpp -pthreadair:~ jose$clang++ -o test -pthread test.o clang: warning: argument unu 在OS X中使用带有clang的pthread库有什么编译器/链接器要求.

使用GCC我知道使用-pthread设置适当的编译器/链接器选项,但我不确定OS X与clang.

air:~ jose$clang++ -c test.cpp -pthreadair:~ jose$clang++ -o test -pthread test.o clang: warning: argument unused during compilation: '-pthread'air:~ jose$g++ -c test.cpp -pthreadair:~ jose$g++ -o test -pthread test.o
解决方法 clang在编译时需要-pthread,但在链接时不需要.pthread.这很烦人,但观察到的行为:
$clang -c x.cpp$clang -pthread -c x.cpp$clang -o x x.o$clang -pthread -o x x.oclang: warning: argument unused during compilation: '-pthread'$$clang --versionApple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)Target: x86_64-apple-darwin13.0.0Thread model: posix$
总结

以上是内存溢出为你收集整理的c – OS X clang -pthread全部内容,希望文章能够帮你解决c – OS X clang -pthread所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/langs/1233274.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存