Mex error. Collect2 -lstdc++

5 次查看(过去 30 天)
Jonathan Sullivan
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?

回答(1 个)

Ken Atwell
Ken Atwell 2012-4-3
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.

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by