Why do I get a compile error with my S-Function Builder generated S-Function with the Simulink Coder?

35 views (last 30 days)
I have a Simulink model containing an S-Function that has been generated with the S-Function Builder.
I am trying to compile this model with the Simulink Coder.
The build throws the following error:
testsfun2.obj : error LNK2019: unresolved external symbol test1_Outputs_wrapper referenced in function testsfun2_step
..\testsfun2.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\link.EXE"' : return code '0x460'

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Feb 2019
The error message shows that the file 'test1_wrapper.c' cannot be found by the compiler.
This file is generated by the S-Function Builder and contains C-code that is called by the S-Function. The S-Function Builder automatically includes this wrapper file in the compilation of the generated code.
However, in your case, you are trying to use a simple S-Function block to call this S-Function. This block does not “know” that there is a wrapper file somewhere.
You need manually to add this C-file as additional source file in the configuration parameters under “Code Generation->Custom Code” in order to compile this model.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2012b

Community Treasure Hunt

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

Start Hunting!