From: fabian on
Dear all,

I am getting a linking error when using realtime Workshop to create a standalone from a simulink model which includes a library.

I am trying to create a standalone from a simulink model using Matlabs Realtime Workshop. The simulink model consists of a s function builder block which includes a C++ library (MyLIBcpp.lib). The s function builder block simply calls some functions from the library and gets some return values. The model itself compiles and runs. However, if I try to create a standalone with rtw I get the following linking error:

MyLIBcpp.lib(FooMatlab.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE(a)ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0(a)ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
...\WillItBend.exe : fatal error LNK1169: one or more multiply defined symbols found
NMAKE : fatal error U1077: '"c:\program files\microsoft visual studio 9.0\VC\BIN\link.EXE"' : return code '0x491'
Stop.

The library was created with Microsoft Visual Studio 2008 and I use its compiler in Matlab. I am using Matlab R2010a.

Specifically, I couldnt figure out where to set the' /NODEFAULTLIB:library' option.

Any hints are greatly appreciated.

Fabian