Getting "Undefined reference to" errors when building S-Function using S-Function Builder block

8 次查看(过去 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
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.
Saiesh Singh
Saiesh Singh 2024-5-15
Hi Piyush,
It would seem I missed adding the ENTRY for the source files. With that the "undefined reference to" errors are gone but now I am getting some new errors:
C:\Users\User\AppData\Local\Temp\ccgb5CZf.s: Assembler messages: C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:16: Error: no such instruction: `mrs %eax,primask' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:43: Error: no such instruction: `mrs %ecx,primask' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:62: Error: no such instruction: `cpsid i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:95: Error: no such instruction: `cpsie i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:124: Error: no such instruction: `mrs %ecx,primask' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:143: Error: no such instruction: `cpsid i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:176: Error: no such instruction: `cpsie i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:205: Error: no such instruction: `mrs %ecx,primask' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:224: Error: no such instruction: `cpsid i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:257: Error: no such instruction: `cpsie i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:286: Error: no such instruction: `mrs %ecx,primask' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:305: Error: no such instruction: `cpsid i' C:\Users\User\AppData\Local\Temp\ccgb5CZf.s:338: Error: no such instruction: `cpsie i'
Component:S-function Builder | Category:Build error
What could be the issue?

请先登录,再进行评论。

回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by