How can I generate a MEX file from my C++ code that utilizes the SGI standard template library in MATLAB 7.13 (R2011b)?

2 views (last 30 days)
I have a function written in C++ and would like to generate a MEX file from it to use in MATLAB 7.13 (R2011b). The code uses the old SGI standard template library (STL).
However, when I try to compile, I get numerous errors such as:
.\stl_function.h(146) : warning C4346: '_Predicate::argument_type' : dependent name is not a type
prefix with 'typename' to indicate a type
.\stl_function.h(154) : see reference to class template instantiation 'std::unary_negate<_Predicate>' being compiled
.\stl_function.h(146) : error C2923: 'std::unary_function' : '_Predicate::argument_type' is not a valid template type argument for parameter '_Arg'
.\stl_function.h(146) : error C2955: 'std::unary_function' : use of class template requires template argument list
.\stl_function.h(37) : see declaration of 'std::unary_function'
.\stl_function.h(151) : warning C4346: '_Predicate::argument_type' : dependent name is not a type
prefix with 'typename' to indicate a type
.\stl_function.h(151) : error C2061: syntax error : identifier 'argument_type'
.\iterator.h(38) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
and much more.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Feb 2012
The SGI standard template library has not been updated by its developers for more than a decade and is too old to be compiled by recent compilers. It also uses old iostream libraries that are no longer available. None of the supported compilers for MATLAB 7.13 (R2011b) can compile the SGI STL code so the C++ file must be updated to remove dependencies on the SGI STL.
Additionally, supported compilers from older versions of MATLAB are not expected to work either. Only Microsoft Visual C++ 5.0 or SGI 7.1 compilers (from 1997) are tested with the SGI STL library.

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Products


Release

R2011b

Community Treasure Hunt

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

Start Hunting!