我是 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.
如何编译这个文件?
wheres g++ 输出
g++: /usr/bin/g++ /usr/share/man/man1/g++.1.gz
MatLab版本为2018R
最佳答案
您的 gcc-4.8.5
版本太旧。来自错误信息的链接http://mathworks.com/support/requirements/supported-compilers.html列出了在 Linux 上对 gcc-6.3.X 的支持。请将您的编译器升级到 gcc-6.3 或更高版本。
关于c++ - Mex 找不到 g++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58324969/