[英]OS X clang -pthread
在OS X中使用帶有clang的pthread庫有什么編譯器/鏈接器要求。
使用GCC我知道使用-pthread設置適當的編譯器/鏈接器選項,但我不確定OS X與clang。
air:~ jose$ clang++ -c test.cpp -pthread
air:~ jose$ clang++ -o test -pthread test.o
clang: warning: argument unused during compilation: '-pthread'
air:~ jose$ g++ -c test.cpp -pthread
air:~ 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.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
$
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.