'Undefined reference to' error in S-function builder
23 次查看(过去 30 天)
显示 更早的评论
I have this in the S-function Libraries pane
Library/Object/Source file
convert_ok
Include files and external function declarations
#include <math.h>
#include <stdio.h>
#include <string.h>
I call the function in the Output pane
y[0]=Convert(u[0])
*Note: Convert() is a function inside the convert_ok.c source file. During compilation and building the S-function, it gives me the following error ' undefined reference to _Convert' at the y[0]=Convert(u[0]) line in the wrapper file. What is the problem? How can i make this work?
0 个评论
采纳的回答
Kaustubha Govind
2013-1-11
In the Library/Object/Source file pane, you need to specify the full filename (including the .c extension):
convert_ok.c
You may also need to specify the full path to the .c file if it is not present in the current directory.
3 个评论
Mark McBroom
2019-11-9
编辑:Mark McBroom
2019-11-9
You need to define the function prototype for the function Convert and place this in a header file, for example convert_ok.h. Then, add #include "convert_ok.h" to the s-function builder block after your other #include statements. See the "S-Function Builder" section of this page:
Poornima Pagadala
2019-11-11
编辑:Poornima Pagadala
2019-11-11
I have include header file also to the sfunction builder block,also I am getting undefined reference error in this way:
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x3f): undefined reference to `oel_rtos_wince_restore_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x5a): undefined reference to `oel_rtos_wince_disable_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x89): undefined reference to `oel_rtos_wince_disable_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x129): undefined reference to `oel_rtos_wince_restore_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x167): undefined reference to `oel_u_queuei_init'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x1b6): undefined reference to `scl_j1939_cat_ppgn_id_install_command'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x1fd): undefined reference to `scl_j1939_cat_ppgn_id_install_command'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x244): undefined reference to `scl_j1939_cat_ppgn_id_install_command'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x250): undefined reference to `scl_pgb_j1939_feature_ack_rspnse_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x257): undefined reference to `scl_pgb_j1939_feature_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x263): undefined reference to `scl_j1939_fmgr_install_client'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x27b): undefined reference to `scl_j1939_fmgr_install_server'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x28e): undefined reference to `scl_pgb_j1939_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x295): undefined reference to `scl_j1939_install_service_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x2a8): undefined reference to `scl_pgb_j1939_stop_bcast'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x2ad): undefined reference to `scl_j1939_add_stop_bcast_client'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x320): undefined reference to `scl_j1939_is_valid_link'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x352): undefined reference to `oel_u_queuei_init'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x363): undefined reference to `oel_u_oheap_init'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x36f): undefined reference to `oel_u_oheap_prealloc_objects'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x418): undefined reference to `scl_j1939_cat_ppgn_id_install_command'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x42f): undefined reference to `scl_j1939_cmgr_feature_ack_rspnse_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x436): undefined reference to `scl_j1939_cmgr_feature_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x442): undefined reference to `scl_j1939_fmgr_install_client'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x458): undefined reference to `scl_j1939_fmgr_install_server'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x466): undefined reference to `scl_j1939_cmgr_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x46d): undefined reference to `scl_j1939_install_service_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x4b3): undefined reference to `scl_pgb_j1939_ecm_init'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x4c5): undefined reference to `oel_rtos_wince_disable_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x4f0): undefined reference to `oel_rtos_wince_restore_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x53a): undefined reference to `scl_pgb_j1939_get_ecm'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x58b): undefined reference to `scl_pgb_j1939_ecm_add_rx_grps'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x68c): undefined reference to `oel_rtos_wince_disable_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.text+0x6ac): undefined reference to `oel_rtos_wince_restore_interrupts'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.y29J1939__PortMgrStatic_i[.refptr.y29J1939__PortMgrStatic_i]+0x0): undefined reference to `y29J1939__PortMgrStatic_i'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_j1939_cmgr_update[.refptr.scl_j1939_cmgr_update]+0x0): undefined reference to `scl_j1939_cmgr_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_j1939_cmgr_feature_clbk[.refptr.scl_j1939_cmgr_feature_clbk]+0x0): undefined reference to `scl_j1939_cmgr_feature_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_j1939_cmgr_feature_ack_rspnse_clbk[.refptr.scl_j1939_cmgr_feature_ack_rspnse_clbk]+0x0): undefined reference to `scl_j1939_cmgr_feature_ack_rspnse_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_j1939_cmgr_rx_cmd[.refptr.scl_j1939_cmgr_rx_cmd]+0x0): undefined reference to `scl_j1939_cmgr_rx_cmd'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.Gpast_link_table[.refptr.Gpast_link_table]+0x0): undefined reference to `Gpast_link_table'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_stop_bcast[.refptr.scl_pgb_j1939_stop_bcast]+0x0): undefined reference to `scl_pgb_j1939_stop_bcast'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_update[.refptr.scl_pgb_j1939_update]+0x0): undefined reference to `scl_pgb_j1939_update'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_feature_clbk[.refptr.scl_pgb_j1939_feature_clbk]+0x0): undefined reference to `scl_pgb_j1939_feature_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_feature_ack_rspnse_clbk[.refptr.scl_pgb_j1939_feature_ack_rspnse_clbk]+0x0): undefined reference to `scl_pgb_j1939_feature_ack_rspnse_clbk'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_rx_data[.refptr.scl_pgb_j1939_rx_data]+0x0): undefined reference to `scl_pgb_j1939_rx_data'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_rx_response[.refptr.scl_pgb_j1939_rx_response]+0x0): undefined reference to `scl_pgb_j1939_rx_response'
C:\Users\DISPLA~1\AppData\Local\Temp\mex_8354074037145409_11524\J1939_PGB_Update_wrapper.obj:J1939_PGB_Update_wrapper.c:(.rdata$.refptr.scl_pgb_j1939_rx_request[.refptr.scl_pgb_j1939_rx_request]+0x0): undefined reference to `scl_pgb_j1939_rx_request'
collect2.exe: error: ld returned 1 exit status
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!