Getting "Undefined reference to" errors when building S-Function using S-Function Builder block
13 次查看(过去 30 天)
显示 更早的评论
I am creating a S-Function in simulink with the S-Function Builder block. I was initially facing "file not found" errors for some of the headers I am using in the code which got resolved after I put the entire path to the headers and source files in the libraries tab of the builder. However, I am now getting "undefined reference to" errors for all the functions that use the headers I included.
C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x76): undefined reference to `Fee_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x7b): undefined reference to `MemAcc_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x80): undefined reference to `Fee_GetStatus' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xa5): undefined reference to `Fee_Read' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xb6): undefined reference to `Fee_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xbb): undefined reference to `MemAcc_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xc0): undefined reference to `Fee_GetStatus' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xe8): undefined reference to `Fee_Read' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xf6): undefined reference to `Fee_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0xfb): undefined reference to `MemAcc_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x100): undefined reference to `Fee_GetStatus' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x128): undefined reference to `Fee_Read' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x136): undefined reference to `Fee_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x13b): undefined reference to `MemAcc_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x140): undefined reference to `Fee_GetStatus' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x168): undefined reference to `Fee_Read' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x176): undefined reference to `Fee_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x17b): undefined reference to `MemAcc_MainFunction' C:\Users\User\AppData\Local\Temp\mex_90014370683397_13052\NVMRead_wrapper.obj:NVMRead_wrapper.c:(.text+0x180): undefined reference to `Fee_GetStatus'
How do I resolve this? I am using Matlab 2022a
2 个评论
Piyush Kumar
2024-5-14
Hi Saiesh,
Refer to the "Use the Libraries Table to Specify External Code and Paths" section of the documentation - https://www.mathworks.com/help/releases/R2022a/simulink/sfg/s-function-builder-dialog-box.html and make sure that you are including the header and source files as mentioned in the documentation link. There are some examples available in the doc as well.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!