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 日

1 投票

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 件のコメント

Subin
Subin 2011 年 11 月 25 日
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?
Kaustubha Govind
Kaustubha Govind 2011 年 11 月 28 日
Try "ls -l /usr/lib/libstdc++*" at the system shell.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by