GCC 环境变量设置

GCC的头文件和库的搜索路径可以通过shell中的环境变量进行控制。可以通过设置如'.bash_profile'这样的登录文件自动为每个会话设置这些变量。可以使用`CPATH`(针对C头文件)和`CPLUS_INCLUDE_PATH`(针对C++头文件)添加额外的包含目录,而`LD_LIBRARY_PATH`用于添加链接路径。这些环境变量设定后,编译器将在标准默认目录之前搜索指定的自定义目录。
摘要由CSDN通过智能技术生成

Environment variables

The search paths for header files and libraries can also be controlled through environment variables in the shell. These may be set automatically for each session using the appropriate login file, such as ‘.bash_profile’ in the case of GNU Bash.

Additional directories can be added to the include path using the environment variable C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files). For example, the following commands will add ‘/opt/gdbm-1.8.3/include’ to the include path when compiling C programs:

$ C_INCLUDE_PATH=/opt/gdbm-1.8.3/include 
$ export C_INCLUDE_PATH

and similarly for C++ programs:

$ CPLUS_INCLUDE_PATH=/opt/gdbm-1.8.3/include 
$ export CPLUS_INCLUDE_PATH

This directory will be searched after any directories specified on the com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值