c++ - Mex 找不到 g++

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

如何编译这个文件?

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/

相关文章:

c++ - 停止调用析构函数

matlab - 使用 CPU 的所有核心

matlab:找到图片中对象的外边缘

c++ - 如何用共享库替换可执行 C++ 程序的函数?

c++ - 我可以在 XCode 4 或 OSX Lion 中使用 C++11 的最新功能吗?

c++ - 如何在g++中构建静态库

c++ - + 运算符重载以添加不同的 C++ 类对象

c++ - 嵌入式 C/C++ : undefined reference of an existing symbol

c++ - 截断整数的好方法

matlab - Matlab 中的 GPS 区域选择