clang: warning: argument unused during compilation: '-pthread'
编译gtest时报了一个警告错误,查询发现有人说重装clang,可是我不会重装,不想折腾一直是使用自动升级来更新xcode。
c++ -isystem ../../googletest/include -isystem ../include -g -Wall -Wextra -pthread -lpthread gmock_test.o gmock_main.a -o gmock_test
clang: warning: argument unused during compilation: '-pthread'
后来发现so上有一篇纪实,也就是说clang时编译时使用这个参数,链接的时候时不使用这个参数的,所以可以忽略这个警告。
clang requires -pthread when compiling but not when linking.
This is annoying, but it is observed behavior:
$ 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 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
网站不错!