s functions causing build errors
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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 个评论
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!