Hello!
I have a C++ project that I want to wrap into a S-Function block that should be compatible with Simulink RTWin target (Matlab 2014b). The C++ project uses the C++11 STL (interfaces like std::vector, std::stack, std::complex, …).
I've created a S-Function wrapper (using the "extern C" Interface) that I can compile in Simulink after providing all include and source files (Model Preferences -> Code Generation -> Custom Code). I am even able to successfully compile the model for Simulink Real-Time Target (xPC Target).
Now when I switch to the rtwin.tcl target, I am only able to compile the project in Normal mode. Compiling in External mode results in compilation errors:
< complex > file not found". Or < vector > file not found.
Obviously, the Simulink Coder does not include the STL. After comparing the resulting makefile with the one of Simulink Real-Time Target, I recognized that Simulink Coder invokes gmake (GNU Make) rather than Visual Studio 2013 (selected by mex -setup). Unfortunately, the included gmake does only include a few C-STL implementations and if I set the Target Language to C++ it includes reimplementations of a small subset of C++STL functions.
While searching the internet, I found out that a template makefile called rtwin-vc.tmf was available for compilation with Visual Studio in the past. But the file is not available in recent Matlab Versions.
Does anybody know if I can modify the makefile template to support the Visual Studio Toolchain, or how I can include and link to the C++11 STL using gmake?
In other MatlabCentral (<http://www.mathworks.com/matlabcentral/answers/97907-why-am-i-unable-generate-code-for-real-time-windows-target-3-3-r2009a-for-a-model-that-includes-th) Questions> I've found hints, that no Windows library functions are supported. But in that particular cases the question asker included "windows.h" which is not the case for my project. Or does the STL (e.g. like std::vector) include "windows.h" on Windows Systems?
I left out any compile logs in this question since I am able to compile everything for other targets and the only error message only contains information about missing STL headers. But I could add logs if necessary.
Thank you very much for your answers!
Best Answer