problem with building a simulink model with two s-functions written in C language
7 views (last 30 days)
Show older comments
Hi all, I have a problem with building a Simulink model for Real-time aplication. I try to build a mdl with two S-functions written in C. I use same header files in both S-functions. I have biult the C files with "mex MPCtest1.c MPCtest2.c" (these are very simple test S-functions whih I created to try resolving the problem). Here is the message that Matlab produces:
MPCtest2.obj : error LNK2005: __ssSetInputPortMatrixDimensions already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: __ssSetOutputPortMatrixDimensions already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: __ssSetInputPortVectorDimension already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: __ssSetOutputPortVectorDimension already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssIsRunTimeParamTunable already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssGetSFuncBlockHandle already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: __ssGetCurrentInputPortWidth already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: __ssGetCurrentOutputPortWidth already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWarning already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssGetDTypeIdFromMxArray already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWStr already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWNameValuePair already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWParameters already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWParamSettings already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWWorkVect already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _mexFunction already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWMxVectParam already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _ssWriteRTWMx2dMatParam already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _DYNAMIC_DIMENSION_DEF already defined in MPCtest1.obj
MPCtest2.obj : error LNK2005: _DYNAMIC_DIMENSION already defined in MPCtest1.obj
It would be great if someone could help me.
Thank you!!!
0 Comments
Accepted Answer
Kaustubha Govind
on 1 Sep 2011
You need to compile them separately - they need to be two separate binaries:
mex MPCtest1.c
mex MPCtest2.c
0 Comments
More Answers (1)
See Also
Categories
Find more on Debugging and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!