Getting linking error:2001 while integrating C-code generated from Real time work shop from a simulink block.

Hi,
I am Prem K. Mishra.I have converted one simulink block(designed to calculate displacement over time)into C-code using real time work shop.I am trying to implement the generated C-code into a program written in Micrsoft Visual C++ 6.0. While compiling I am getting linking errors like:
c2_status.obj : error LNK2001: unresolved external symbol _sf_mex_addfield
status_sfun.obj : error LNK2001: unresolved external symbol _mxGetScalar
status_sfun_registry.obj : error LNK2001: unresolved external symbol _mxGetM.
I have added the required .lib files in the additional libraries lists.
Can you please suggest something.If I am missing any .lib files.
Thanks in advance.
Thanks & Regards, Prem

回答(1 个)

You need to use either grt.tlc or ert.tlc as the System Target File for your model. The code that is generated for your model seems to include calls to functions like mxGetScalar and mxGetM which belong to the MATLAB MEX API, and cannot be executed outside of MATLAB. So it seems likely that you are not using the correct process to generate standalone C code.

此问题已关闭。

关闭:

2021-8-20

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by