Why am I getting a linking error about the function defined in the S-function wrapper C file when building my model?

I used a S-function Builder block to generate the S-function source code, TLC, and mex file for me. Then, I replace this S-function Builder block with a S-function block, giving it the name of the generated S-function.
Now, when I build the model, I got an error saying [mdl_name].obj : error LNK2019: unresolved external symbol [sfcnname]_Outputs_wrapper referenced in function [mdl_name]_step.

 採用された回答

MathWorks Support Team
MathWorks Support Team 2017 年 8 月 29 日
The issue is caused by the fact that when the S-function Builder block is taken out, the model is losing information about what source files other than the [s-function name].c would be associated with the MEX file that is given to the S-function block.
In order to the S-function block to know where to look for the _wrapper.c, you need to explicitly tell it in the *S-function modules field of the S-function block. More information about this field can be found here:

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

製品

リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by