Error when building Simulink model with C mex S-function in RTW (R2010b)
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to build a Simulink model containing a C mex S-function with RTW (R2010b), but get following error messages related to mex function calls:
myCode.obj .text: undefined reference to '_mxSetM_700'
myCode.obj .text: undefined reference to '_mxSetN_700'
myCode.obj .text: undefined reference to '_mexCallMATLAB'
myCode.obj .text: undefined reference to '_mxDestroyArray'
myCode.obj .text: undefined reference to '_mexGetVariablePtr'
myCode.obj .text: undefined reference to '_mxGetField_700'
gmake: * [../myCode.exe] Error 111
Do I need to specify extra files in the 'Custom Code' pane of the RTW Options? Any suggestions are very appreciated.
Many thanks in advance, Bert
2 个评论
Kaustubha Govind
2013-12-30
Do these errors show up when building code generated using RTW? Calls to MEX libraries such as mxSetM, etc. should not exist in generated code typically. Is this an un-inlined S-function?
回答(1 个)
Kaustubha Govind
2014-2-11
Bert: You need to modify your S-function code and remove the calls to the mxArray libraries. These libraries only run in the MATLAB environment, and therefore cannot be used in generated code meant to run standalone (without MATLAB). If you absolutely need these calls for simulation, you may write a TLC (see Inlining S-functions to define the behavior in generate code.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from C 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!