'Undefined reference to' error in S-function builder

18 visualizaciones (últimos 30 días)
Zoltan
Zoltan el 11 de En. de 2013
Editada: Poornima Pagadala el 11 de Nov. de 2019
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?

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 11 de En. de 2013
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 comentarios
Mark McBroom
Mark McBroom el 9 de Nov. de 2019
Editada: Mark McBroom el 9 de Nov. de 2019
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
Poornima Pagadala el 11 de Nov. de 2019
Editada: Poornima Pagadala el 11 de Nov. de 2019
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by