假设你的电脑能够访问internet,这个命令会自动从网络下载并把软件安装到本地。
超级用户权限:
#yum -y install gcc-c++
另外一定不要天真的认为linux 下面 编译C++程序,可以用直接用gcc filename.cc,否则会莫名的出现好多链接错误错误。如下:
oot@fedora-odl-1 test]# gcc temp.cc
/tmp/ccGyH0kl.o: In function `main':
temp.cc:(.text+0x87): undefined reference to `std::cout'
temp.cc:(.text+0x8c): undefined reference to `std::ostream::operator<
temp.cc:(.text+0x91): undefined reference to `std::basic_ostream >& std::endl >(std::basic_ostream >&)'
temp.cc:(.text+0x99): undefined reference to `std::ostream::operator<
/tmp/ccGyH0kl.o: In function `__static_initialization_and_destruction_0(int, int)':
temp.cc:(.text+0xc7): undefined reference to `std::ios_base::Init::Init()'
temp.cc:(.text+0xd6): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
[root@fedora-odl-1 test]#
用g++编译则没有问题了 呵呵
或者用gcc指定链接库
gcc temp.cc -lstdc++因为gcc默认不会去链接C++库。