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

标签 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.

当我执行 which g++ 命令时,它什么也没有返回。当我 apt-get install g++ 返回给我时:

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

如何让 MATLAB 识别我的 g++ 编译器?

最佳答案

答案可能已经晚了,但当我遇到类似问题时,以下似乎是解决方案:

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

希望它能帮助每个偶然发现这一点的人。

关于c++ - MATLAB 在 mex_compile Linux 中找不到支持的编译器或 SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41324975/

相关文章:

c++ - C/C++裸机编译和针对特定操作系统(Linux)的编译有什么区别?

c - 为什么文本文件中会出现多余的字符?

c - 如何反转我的 C 列表?

matlab - 将矩阵保存到文件时如何控制格式?

matlab - 用于事件识别的滑动​​窗口算法

c++ - qt从原始数据中注册资源

c++ - 隐藏符号时 dynamic_cast 失败

c++ - 检查 Mutex 释放

c - recvfrom() 会修改 len 吗?

matlab - 在 Matlab 中使用 `spy` 为不同的数字获取不同的颜色