MEX找不到G ++

时间:2019-10-10 14:11:58

标签: c++ matlab g++ mex

我对MatLab完全陌生,我正在尝试通过redhat上的Matlab使用mex编译.cpp文件。以下是我命令的输出

mex myfile.cpp -v

No MEX options file identified; looking for an implicit selection.
... Looking for compiler 'g++' ...
... Executing command 'which g++' ...Yes ('/bin/g++').
... Executing command 'g++ -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so').
... Executing command 'g++ -dumpversion' ...Yes ('4.8.5').
... Executing command 'which g++' ...Yes ('/bin/g++').
... Looking for folder '' ...No.

Did not find installed compiler 'g++'.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.

如何编译此文件?

wheris g ++ 输出

g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz

MatLab版本是2018R

1 个答案:

答案 0 :(得分:1)

您的gcc-4.8.5版本太旧了。错误消息http://mathworks.com/support/requirements/supported-compilers.html的链接列出了对Linux上gcc-6.3.X的支持。请将您的编译器升级到gcc-6.3或更高版本。