对个人用户生效
sudo vim ~/.bashrc
在该文件末尾添加
#gcc
C_INCLUDE_PATH=$C_INCLUDE_PATH:your_path
export C_INCLUDE_PATH
#g++
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:your_path
export CPLUS_INCLUDE_PATH
最后,重启终端即可生效
可用以下命令查看搜索路径
echo | gcc -x c -v -E -
echo | gcc -x c++ -v -E -