环境准备:Ubuntu16,matlab2017(目前只支持gcc4.9)
You could set priority to use [g++/gcc-4.9] before [g++/gcc-5] .
Follow these steps:
--> Make sure gcc-4.9 and g++-4.9 are installed.~$ sudo apt-get install gcc-4.9 g++-4.9
--> Set "priority=100" for gcc-4.9 and "priority=50" for gcc-5.~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 100
~$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5.0 50
--> Set "priority=100" for g++-4.9 and "priority=50" for g++-5.~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 100
~$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5.0 50
--> Verify the priority settings using:~$ update-alternatives --query gcc
Name: gcc
Link: /usr/bin/gcc
Status: auto
Best: /usr/bin/gcc-4.9
Value: /usr/bin/gcc-4.9
Alternative: /usr/bin/gcc-4.9
Priority: 100
Alternative: /usr/bin/gcc-5
Priority: 50
~$ update-alternatives --query g++
Name: g++
Link: /usr/bin/g++
Status: auto
Best: /usr/bin/g++-4.9
Value: /usr/bin/g++-4.9
Alternative: /usr/bin/g++-4.9
Priority: 100
Alternative: /usr/bin/g++-5
Priority: 50
参考https://github.com/vlfeat/matconvnet/issues/967