Mex can't find g++

I'm totally new to MatLab, I'm trying to compile a .cpp file using mex through the Matlab on redhat. Follwing is the output of my command

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.

How can I get this file compiled?

wheris g++ output

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

MatLab version is 2018R

Upvotes: 0

Views: 758

Answers (1)

drescherjm
drescherjm

Reputation: 10857

Your version of gcc-4.8.5 is too old. The link from the error message http://mathworks.com/support/requirements/supported-compilers.html lists support for gcc-6.3.X on linux. Please upgrade your compiler to gcc-6.3 or greater.

Upvotes: 1

Related Questions