compile C code in matlab from linux

I am getting this error when i try to compile the engdemo.c
The command used is.
mex -f engopts.sh engdemo.c -v
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libmwfl.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<void const*>(void const*)@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<long>(long)@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<bool>(bool)@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long)@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libmwfl.so: undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'
/cad/local/apps/mathworks/matlab/2009a/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<double>(double)@GLIBCXX_3.4.9'
collect2: ld returned 1 exit status

 采纳的回答

Kaustubha Govind
Kaustubha Govind 2011-11-23
What version of gcc are you using? You need gcc 4.2.3 for R2009a on Linux. Make sure that you select this compiler with "mex -setup". If you are indeed using gcc 4.2.3, you may need to update your libstdc++ libraries to match your gcc version. For gcc 4.2.3, libstdc++.so.6.0.9 or higher is required.

2 个评论

Thanks for the reply. But the matlab(R2009a) was showing the supported gcc version is from 4.1 to 4.2. I am using 4.1.2.
How to check libstdc++ library version?
Try "ls -l /usr/lib/libstdc++*" at the system shell.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB Compiler 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by