需要更改include的包含路径 [英] Need to change include path for clang

查看:119
本文介绍了需要更改include的包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用clang编译时,似乎正在使用gcc4.4.4版本的包含文件,而我希望它使用更新的文件。

When building with clang, it seems to be using gcc4.4.4 version of include files, while I want it to use newer ones.

[ ~ ] locate move.h
/home/apps/gcc_versions/gcc-4_8_install/include/c++/4.8.3/bits/move.h
/usr/include/c++/4.4.4/bits/move.h
/usr/local/include/c++/4.7.1/bits/move.h

gcc路径:

`gcc -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3
 /apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3/x86_64-unknown-linux-gnu
 /apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3/backward
 /apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/include
 /usr/local/include
 /apps/gcc_versions/gcc-4_8_install/include
 /apps/gcc_versions/gcc-4_8_install/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/include-fixed
 /usr/include
End of search list.

gcc可以正常工作
,但是用clang失败了

And gcc includes work fine But with clang it fails

[ ~ ] clang -v
clang version 3.5 (http://llvm.org/git/clang.git 8e674ff884113429b53d23b18409caf67aaec1b7) (http://llvm.org/git/llvm.git 7add5421a686877e0aa87616b92b1f5a85c6feee)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.4.7

我是新手,如果缺少一些信息,请提出建议

I am a newbie at this and please suggest if some info is missing that would help to resolve this.

推荐答案

尝试按以下方式进行编译,

Try compiling as following,

clang ++ -isystem / SOMEPATH / gc c-4.9.2 / include / c ++ / 4.9.2 -I / SOMEPATH / gcc-4.9.2 / include / c ++ / 4.9.2 / x86_64-unknown-linux-gnu a.cpp

这篇关于需要更改include的包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆