MATLAB: Am I unable to compile the model when using Microsoft Visual Studio 6.0 with Real-Time Workshop Embedded Coder 4.4 (R2006a)

Embedded Coderrealtime

When compiling my model I receive the following error messages from the linker:
### Linking ...
C:\Programme\MATLAB\R2006a\sys\perl\win32\bin\perl C:\Programme\MATLAB\R2006a\rtw\c\tools\mkvc_lnk.pl test_amplifier_cpp.lnk test_amplifier_cpp.obj test_amplifier_cpp_data.obj ert_main.obj
link /RELEASE /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO -subsystem:console,4.0 libc.lib oldnames.lib kernel32.lib ws2_32.lib mswsock.lib advapi32.lib C:\Programme\MATLAB\R2006a\rtw\c\lib\win32\rtwlib_ert_vc.lib @test_amplifier_cpp.lnk -out:..\test_amplifier_cpp.exe
test_amplifier_cpp.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)
test_amplifier_cpp_data.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)
test_amplifier_cpp.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)
test_amplifier_cpp_data.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)
test_amplifier_cpp.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)
test_amplifier_cpp_data.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::_Winit::_Winit(void)" (??0_Winit@std@@QAE@XZ)
test_amplifier_cpp.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)
test_amplifier_cpp_data.obj : error LNK2001: Nichtaufgeloestes externes Symbol "public: __thiscall std::_Winit::~_Winit(void)" (??1_Winit@std@@QAE@XZ)
<SNIP>
When I use the Microsoft Visual Studio 7.1, the model compiles and links successfully.

Best Answer

This problem results from the use of C++ iostream utilities (in an S-Function) whose libraries are not linked by MSVC 6.0 by default. To prevent the problem, add the corresponding MSVC runtime libraries, which are "libcp.lib" and "msvcprt.lib", to the Custom Code Libraries. To do that:
1) Under "Configuration Parameters" go to "Real-Time Workshop -> Custom Code -> Include list of additional".
2) Put "libcp.lib" and "msvcprt.lib" in the "Libraries" tab, and the corresponding MSVC 6.0 runtime library directory path in the "Include directories" tab.
You should be able to build the model without encountering this problem.