[本地环境]
操作系统:Ubuntu14.04 64bits
MATLAB:R2014a
用matlab跑程序,报错如下:
Warning: You are using gcc version '4.8.4'. The version of gcc is not supported.
The version currently supported with MEX is '4.7.x'. For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release.
详细如下图所示:
1. 更新添加镜像源
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
2. 安装gcc和g++
sudo apt-get install gcc-4.7
sudo apt-get install g++-4.7
3. 删除原来符号链接并重新建立新的链接
which gcc
cd /usr/bin/
sudo rm gcc
sudo ln -s gcc-4.7 gcc
gcc -v
sudo rm g++
sudo ln -s g++-4.7 g++
g++ -v
4. 卸载(备注)
sudo apt-get remove g++-4.7
sudo apt-get remove gcc-4.7