Reference blog: Http://blog.csdn.net/thystar/article/details/50720691caffe only supports gcc-4.7 in MATLAB, but ubuntu14.04 installs gcc-4.8 by default.
Select Install gcc-4.7 and downgrade as follows:
Download and install gcc-4.7 and g++-4.71
sudo apt-get install gcc-4.72
sudo apt-get install g++-4.7
Linking gcc-4.7 and g++-4.7 for demotion
1 Cd/usr/bin
2 sudo rm gcc
3 sudo ln-s gcc-4.7 gcc
4 sudo rm g++
5 sudo ln-s g++-4.7 g++
6 # See if you are connected to 4.7.x
7 Ls–al gcc g++
8 gcc--version
9 g++--version
After the installation, you need to modify the caffe\makefile.config inside the MATLAB path.
Matlab_dir: =/usr/local/matlab/r2013b
Save and recompile
1 sudo make clean
2 make all
3 make test
4 make runtest
5 make Matcaffe
May appear:
Makefile:518:recipe for Target ' matlab/+caffe/private/caffe_.mexa64 ' failed
Make: * * * [matlab/+caffe/private/caffe_.mexa64] Error 255
Workaround:
In makefile, about the No. 410 line that sentence cxxflags + =-mmd-mp Add cxxflags + =-std=c++11 below, and finally this
Cxxflags + =-mmd-mp
Cxxflags + =-std=c++11
Then make Clean,make all in the Caffe root directory