Why do I get a compile error when generating code for an automatically generated S-Function?

I am running into an error while generating code for an S-Function that I have previously build via the right-click menu 'C/C++ Code > Generate S-Function', based on a Simulink model I created. The error specifically mentions:
_Subsystem_sf.obj : error LNK2019: unresolved external symbol ssFxpSetU32BitRegionCompliant referenced in function mdlInitializeSizes
..\untitled.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'
Stop._
I want to make sure that the file 'ssFxpSetU32BitRegionCompliant', mentioned in the error, is included in the build.

 採用された回答

MathWorks Support Team
MathWorks Support Team 2019 年 4 月 16 日

0 投票

Two possible workaround exist for the issue at hand:
  1. If you need to generate a Windows executable, please add the output of the following command to 'Configuration Parameters > Code Generation > Custom Code > Additional build information: Libraries' of the S-Function model:* >> fullfile(matlabroot,'extern\lib\win64\microsoft\libfixedpoint.lib')
  2. If you need to generate code for a specific target, please open the file '<MODELNAME>_sf.c' file in the '<MODELNAME>_sfcn_rtw' folder, and add the following statements before and after the 'ssFxpSetU32BitRegionCompliant(S, 1);' line:* Before: #if defined (MATLAB_MEX_FILE)* After: #endif

その他の回答 (0 件)

カテゴリ

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

製品

リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by