s functions causing build errors

2 次查看(过去 30 天)
Michael Joslin
Michael Joslin 2011-11-16
I am integrating new rapid prototyping software and everything is going fine until we try to build code that contains s-function blocks. With no alteration to the configuration parameters I get the following error:
ERROR -- DRIVER: 0x206210E6: HIGHTEC_GCC_LINKER: C:\Users\CZQFQP\Desktop\sfunctioDebug\sfunction_debug_ehooks_ert_rtw/sfunction_debug.c:50: undefined reference to `ApplyFILT_1stOrderLag_flt'
I have tried adding #include "ApplyFILT_1stOrderLag_flt.c", #include "(Directory)\ApplyFILT_1stOrderLag_flt.c", adding the directories and combinations of these and others to varying degrees of failure. I read up on s-functions and realized that these s-functions I am using may be inlined or wrapped (I did not write these functions) because they have .tlc file associated with them. Do I need to include these somehow? This issue is taking the rapid out of the prototyping and any help would be appreciated.

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2011-11-16
Do you have access to ApplyFILT_1stOrderLag_flt.c? Does it contain a function/variable called ApplyFILT_1stOrderLag_flt? If not, perhaps there is a library file that defines this symbol? It is hard for us to tell, because we don't know what the author of the S-function included.
Once you have located the symbol in a .c, or .lib file, you need to add that to your linker command. Are you compiling outside of MATLAB, or are you relying on Simulink to finish the build? If it is the latter, check if there is a file called rtwmakecfg.m in the same folder as the S-function (this is where custom build rules are defined).
  2 个评论
Michael Joslin
Michael Joslin 2011-11-16
I looked in ApplyFILT_1stOrderLag_flt.c and the only time I saw this name was at the s-function definition: #define S_FUNCTION_NAME ApplyFILT_1stOrderLag_flt. I several files that define this blockset the most important being (I think) gmlib_sfun.lib and gmlib.mdl. I don't think the .c file defining what you mentioned so I'm going to try adding the .lib file to the linker command. Problem is I'm not entirely sure what you mean by add to linker command or how to do it.
Also we are using a System Target File given to us by ETAS to run with e-hooks, could this cause an issue?
Kaustubha Govind
Kaustubha Govind 2011-11-16
If you can find a rtwmakecfg.m in the same folder as the S-function, you can add the .lib to the build rules for this S-function by adding the name of the library to makeInfo.linkLibsObjs (see http://www.mathworks.com/help/toolbox/rtw/ug/f67543.html#bp67s_y-1).
Using a custom System Target File could be a cause for the issue if they somehow modified the template makefile (.tmf file) corresponding to the .tlc file such that the build doesn't do the right thing. If you'd like to, you could also modify the .tmf file and add the library to the linker command there. You can do a text search for ".lib" or other linker-related stuff to find the right location.
It seems to me like the right solution would be to contact the vendor of the S-function. Either they haven't tested the code-generation extensively, or you're not using the block like they intended to.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by