ubuntu12.04默认gcc4.6.3,如何升级到gcc4.8

来源:互联网 发布:阿里巴巴java开发手册 编辑:程序博客网 时间:2024/05/17 06:39

FROM:http://blog.csdn.net/ppp2006/article/details/52183472


之前所有在12.04上面的工作 对于gcc版本没有特殊要求,最近ORBSLAM2要求支持C++11.

今天安装SDL明确要求GCC4.8以上版本,否则出现错误。

这里记录升级方法:  http://blog.csdn.NET/linsanhua/article/details/38047559

1.) Press Ctrl+Alt+T on your keyboard to open terminal. When it opens, run below commands to add the ppa:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

2.) Then install gcc 4.8 and g++ 4.8:

sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8

3.) Once installed, run following commands one by one to use gcc 4.8 instead of previous version.

sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20sudo update-alternatives --config gccsudo update-alternatives --config g++

Now you have the gcc 4.8 with c++11 complete feature in your system. Check out by:

gcc --version

gcc (Ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/
0 0
原创粉丝点击