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

 Risposta accettata

Kaustubha Govind
Kaustubha Govind il 23 Nov 2011

1 voto

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 Commenti

Subin
Subin il 25 Nov 2011
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.

Accedi per commentare.

Più risposte (0)

Categorie

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by