赞
踩
1、设置linux默认的环境变量
1.1 查看当前默认的环境变量:
echo PATH
结果:
root@hyman-laptop:/home/hyman/src# echoPATH
结果:
root@hyman-laptop:/home/hyman/src# echoPATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/snap/bin
1.2 在环境变量里增加新的路径 /home/mlm
在/etc/profile 文件中最后面增加下面这句话:
export PATH=$PATH:/home/mlm
1.3 保存后在终端中输入下面的语句,以重启配置:
source /etc/profile
1.4 再次查询,发现已经成功:
root@hyman-laptop:/home/hyman/src# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/snap/bin:/home/mlm
2、设置gcc默认的inlcude路径(在终端或在/etc/profile输入):
C_INCLUDE_PATH=/new/include/dir
export C_INCLUDE_PATH
3、设置g++默认的include路径(在终端或在/etc/profile输入):
CPLUS_INCLUDE_PATH=/new/include/dir
export CPLUS_INCLUDE_PATH
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。