环境准备: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: gccLink: /usr/bin/gccStatus: autoBest: /usr/bin/gcc-4.9Value: /usr/bin/gcc-4.9Alternative: /usr/bin/gcc-4.9Priority: 100Alternative: /usr/bin/gcc-5Priority: 50
~$ update-alternatives --query g++
Name: g++Link: /usr/bin/g++Status: autoBest: /usr/bin/g++-4.9Value: /usr/bin/g++-4.9Alternative: /usr/bin/g++-4.9Priority: 100Alternative: /usr/bin/g++-5Priority: 50 参考https://github.com/vlfeat/matconvnet/issues/967