我见过其他SO问题,但他们没有回答我的问题。
我尝试使用-isystem指令,该指令将clang include路径移至顶部,但不会删除gcc库。
不使用-isystem参数:
clang++ -v test.cpp
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
/usr/local/include
/usr/local/lib/clang/9.0.0/include
/usr/include/x86_64-linux-gnu
/usr/include
使用-isystem指令后:
clang++ -isystem /usr/local/lib/clang/9.0.0/include -v test.cpp
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/clang/9.0.0/include
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
理想情况下,我根本不希望包含gcc库。即仅应在/usr/local/lib/clang/9.0.0中进行搜索。但是,我不想以任何方式打扰gcc。
我该如何实现?