如何在Linux中添加默认的gcc路径? [英] How to add a default include path for gcc in linux?

查看:1387
本文介绍了如何在Linux中添加默认的gcc路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了通常的包含目录之外,我希望gcc可以从 $ HOME / include 中添加文件,但似乎并没有类似于 $ LD_LIBRARY_PATH 。我知道我可以在编译(或在makefile)中添加命令行中的include目录,但是我真的很喜欢这样一个通用的方法,就像在库中一样。

I'd like gcc to include files from $HOME/include in addition to the usual include directories, but there doesn't seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I'd really like a universal approach here, as in the library case.

推荐答案

尝试设置 C_INCLUDE_PATH (C头文件)或 CPLUS_INCLUDE_PATH (C ++头文件)。

Try setting C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files).

由于Ciro提到, CPATH 将为C和C ++设置路径。

As Ciro mentioned, CPATH will set the path for both C and C++.

更多详情这里

这篇关于如何在Linux中添加默认的gcc路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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