MATLAB在mex_compile Linux中找不到支持的编译器或SDK

时间:2016-12-25 22:30:38

标签: c++ c matlab gcc matconvnet

我不得不将我的GCC降级到版本4.7,因为我在编译matConvnet时遇到了这种问题

Warning: You are using gcc version '5.4.0'. 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.

所以,我做了以下步骤,使GCC 4.7.0成为我机器的默认编译器:

sudo apt-get install gcc-4.7
sudo rm /usr/bin/gcc
ln -s /usr/bin/gcc-4.7 /usr/bin/gcc

然而,当我再次尝试编译Matconvnet时,我遇到以下错误:

  Error using vl_compilenn>mex_compile (line 434)
  No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2016a/glnxa64.html.

  Error in vl_compilenn (line 387)
  parfor i = 1:numel(horzcat(lib_src, mex_src))  

我的手术错过了什么?

编辑:我意识到问题出在g ++编译器上

当我在MATLAB中执行mex -setup C ++命令时出现此错误:

Error using mex
No supported compiler or SDK was found. For options, visit     http://www.mathworks.com/support/compilers/R2016a/glnxa64.html.

当我执行哪个g ++命令时,它什么都没有返回。当我apt-get install g ++时,以下内容返回给我:

g++ is already the newest version (4:5.3.1-1ubuntu1).

我能做些什么来让MATLAB识别我的g ++编译器?

1 个答案:

答案 0 :(得分:0)

答案可能会迟到,但当我遇到类似的问题时,以下似乎是解决方案:

sudo apt-get install --reinstall gcc
sudo apt-get install --reinstall g++

希望每个偶然发现它的人都能帮到你。