Clear Filters
Clear Filters

Mex error. Collect2 -lstdc++

5 views (last 30 days)
Jonathan Sullivan
Jonathan Sullivan on 2 Apr 2012
Hey. I'm trying to compile a mex function, and I'm having a little trouble. Any help would be appreciated.
The command is
mex('-DDEFINEUNIX','-largeArrayDims','mtimesx.c','/usr/lib64/libblas.so.3.2.1')
and the error I'm getting is:
Warning: You are using gcc version "4.4.0". The version
currently supported with MEX is "4.3.4".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
mtimesx.c: In function mexFunction:
mtimesx.c:592: warning: assignment discards qualifiers from pointer target type
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
mex: link of ' "mtimesx.mexa64"' failed.exa64"' failed.
Any thoughts on what might be going wrong?

Answers (1)

Ken Atwell
Ken Atwell on 3 Apr 2012
What Linux distro are you running? I'll ignore the warns and address the link error:
It looks like the g++ libraries are not installed on your system, and MATLAB needs to them to link. Yes, you are "only" using C and not C++, but the MATLAB libraries you link against require C++ libraries.
In short, you'll want to install the "gcc-g++" package, or something with a similar name, depending on the distribution you are using.

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!