LINUX下如何配置C++环境变量
来源:百度知道 编辑:UC知道 时间:2024/07/08 11:23:48
今天刚装的LINUX,准备写2个C++程序.
发现不能用G++编译.
我知道去找~/.bash_prfile文件.
但是不知道如何配置,达人们指教下~~
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
CC=/usr/bin/gcc
CCC=/usr/bin/g++
PATH=$PATH:$HOME/bin:$PATH:/usr/sbin:.
CLASSPATH CC CCC
unset USERNAME
这是我配置的,还是不能用
我说明下,我是用虚拟机装的redhat9.0.
sudo apt-get install build-essential我试过了,提示是
commod not found
红帽子是不是不支持这个命令.
我在线等,哪位达人能帮解决下~
发现不能用G++编译.
我知道去找~/.bash_prfile文件.
但是不知道如何配置,达人们指教下~~
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
CC=/usr/bin/gcc
CCC=/usr/bin/g++
PATH=$PATH:$HOME/bin:$PATH:/usr/sbin:.
CLASSPATH CC CCC
unset USERNAME
这是我配置的,还是不能用
我说明下,我是用虚拟机装的redhat9.0.
sudo apt-get install build-essential我试过了,提示是
commod not found
红帽子是不是不支持这个命令.
我在线等,哪位达人能帮解决下~
貌似,不能编译和环境变量无关。
楼主,你这个高手都用 RH9 了,还问大家问题啊……
RH9 不支持 apt 的。
先把build-essential装上
g++直接编译
需要其他的库可以用pkg-config自动写参数
rh9严重过时了建议不要用。redhat新版是rhel和fedora
不过现在建议用ubuntu
如果你用的是ubuntu的话,安装很简单的
sudo apt-get install build-essential
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install vim
这几个命令执行完后就配置好了
如果是其它的你需要下载builde-essential离线包后进行安装即可
在安装光盘里把gcc-c++的rpm包选上.
还有编译参数最好写在makefile里,不要设置成公共的环境变量。
是没有 安装 C++程序包吧?
sudo apt-get install build-essential