Problem using C API in an application
Ältere Kommentare anzeigen
I am following the tutorial in the section "Use the C API to Access Model Signals and State"( Help-> Product Help->Simulink Coder->User's Guide->Deployment->Program Building, Interaction and Debugging->Data Exchange->Data Interchange Using the C API->Use the C API in an Application).
In the step 14, I click on the 'Build' button and two windows open: the Code Generation Report and a error window that displays the message 'Error(s) encountered while building model "rtwdemo_capi"'.
The ML's main window shows the following:
### Checking for structural changes in rtwdemo_capi_bot because the model reference rebuild option is set to 'If any changes detected'. Structural changes will cause the model reference SIM target to be rebuilt.
### Checking for structural changes in model reference SIM target for model: rtwdemo_capi_bot
### The code for the model reference SIM target for model rtwdemo_capi_bot is up to date because no functional changes exist in the referenced model.
### Checking for structural changes in rtwdemo_capi_bot because the model reference rebuild option is set to 'If any changes detected'. Structural changes will cause the model reference RTW target to be rebuilt.
### Checking for structural changes in model reference RTW target for model: rtwdemo_capi_bot
### The code for the model reference RTW target for model rtwdemo_capi_bot is up to date because no functional changes exist in the referenced model.
### Starting build procedure for model: rtwdemo_capi
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcc -c -Fortwdemo_capi.obj -DUSE_RTMODEL -DMODEL=rtwdemo_capi -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -I. -I.. -IC:/PROGRA~1/MATLAB/R2012a\simulink\include -IC:/PROGRA~1/MATLAB/R2012a\extern\include -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\libsrc -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\common -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\tcpip -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\serial -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\custom -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB/rtwdemo_capi_grt_rtw -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB -IC:/PROGRA~1/MATLAB/R2012a/toolbox/rtw/rtwdemos -IC:/PROGRA~1/MATLAB/R2012a\sys\lcc\include -Ireferenced_model_includes -I../slprj/grt/_sharedutils -noregistrylookup rtwdemo_capi.c
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcc -c -Fortwdemo_capi_capi.obj -DUSE_RTMODEL -DMODEL=rtwdemo_capi -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -I. -I.. -IC:/PROGRA~1/MATLAB/R2012a\simulink\include -IC:/PROGRA~1/MATLAB/R2012a\extern\include -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\libsrc -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\common -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\tcpip -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\serial -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\custom -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB/rtwdemo_capi_grt_rtw -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB -IC:/PROGRA~1/MATLAB/R2012a/toolbox/rtw/rtwdemos -IC:/PROGRA~1/MATLAB/R2012a\sys\lcc\include -Ireferenced_model_includes -I../slprj/grt/_sharedutils -noregistrylookup rtwdemo_capi_capi.c
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcc -c -Fortwdemo_capi_data.obj -DUSE_RTMODEL -DMODEL=rtwdemo_capi -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -I. -I.. -IC:/PROGRA~1/MATLAB/R2012a\simulink\include -IC:/PROGRA~1/MATLAB/R2012a\extern\include -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\libsrc -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\common -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\tcpip -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\serial -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\custom -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB/rtwdemo_capi_grt_rtw -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB -IC:/PROGRA~1/MATLAB/R2012a/toolbox/rtw/rtwdemos -IC:/PROGRA~1/MATLAB/R2012a\sys\lcc\include -Ireferenced_model_includes -I../slprj/grt/_sharedutils -noregistrylookup rtwdemo_capi_data.c
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcc -c -Fogrt_main.obj -DUSE_RTMODEL -DMODEL=rtwdemo_capi -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -I. -I.. -IC:/PROGRA~1/MATLAB/R2012a\simulink\include -IC:/PROGRA~1/MATLAB/R2012a\extern\include -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\libsrc -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\common -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\tcpip -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\serial -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\custom -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB/rtwdemo_capi_grt_rtw -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB -IC:/PROGRA~1/MATLAB/R2012a/toolbox/rtw/rtwdemos -IC:/PROGRA~1/MATLAB/R2012a\sys\lcc\include -Ireferenced_model_includes -I../slprj/grt/_sharedutils -noregistrylookup C:/PROGRA~1/MATLAB/R2012a/rtw/c/grt/grt_main.c
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcc -c -Fort_sim.obj -DUSE_RTMODEL -DMODEL=rtwdemo_capi -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -I. -I.. -IC:/PROGRA~1/MATLAB/R2012a\simulink\include -IC:/PROGRA~1/MATLAB/R2012a\extern\include -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\libsrc -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\common -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\tcpip -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\serial -IC:/PROGRA~1/MATLAB/R2012a\rtw\c\src\ext_mode\custom -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB/rtwdemo_capi_grt_rtw -IC:/DOCUME~1/GRAHAM~1/MYDOCU~1/MATLAB -IC:/PROGRA~1/MATLAB/R2012a/toolbox/rtw/rtwdemos -IC:/PROGRA~1/MATLAB/R2012a\sys\lcc\include -Ireferenced_model_includes -I../slprj/grt/_sharedutils -noregistrylookup C:/PROGRA~1/MATLAB/R2012a/rtw/c/src/rt_sim.c
Warning C:/PROGRA~1/MATLAB/R2012a/rtw/c/src/rt_sim.c: 68 static `struct TimingData_Tag td_struct' is not referenced
0 errors, 1 warnings
C:/PROGRA~1/MATLAB/R2012a\sys\lcc\bin\lcclnk -s -LC:/PROGRA~1/MATLAB/R2012a\sys\lcc\lib -o ../rtwdemo_capi.exe rtwdemo_capi.obj rtwdemo_capi_capi.obj rtwdemo_capi_data.obj rtwdemo_capi_datalog.obj grt_main.obj rt_sim.obj @rtwdemo_capi_ref.rsp
rtwdemo_capi_datalog.obj .text: undefined reference to '_rtwCAPI_GetNumSigLogRecords'
rtwdemo_capi_datalog.obj .text: undefined reference to '_rtwCAPI_GetNumStateRecords'
gmake: *** [../rtwdemo_capi.exe] Error 2
### Build procedure for model: 'rtwdemo_capi' aborted due to an error.
Any ideas of what may be wrong? I swapped "Program Files" to "Proga~1" in step 6. Please let me know if you need more information.
3 Kommentare
Kaustubha Govind
am 3 Jun. 2013
It looks like both functions are defined in $(MATLAB_ROOT)/rtw/c/src/rtw_modelmap_utils.c - and when I try the same demo model, I see that the generated Makefile (rtwdemo_capi_grt_rtw/rtwdemo_capi.mk, or possibly rtwdemo_capi_grt_rtw/rtwdemo_capi.lmk in your case since you use LCC) does link against this file to generate the final executable. Do you see any reference to this file in your Makefile? I wonder if LCC is the problem. What about if you switch to another supported compiler using mex -setup?
Jose Americo
am 5 Jun. 2013
Kaustubha Govind
am 5 Jun. 2013
Other than rtw_modelmap_utils.c, I also see rt_logging_mmi.c and rt_logging.c being linked against the executable. Perhaps you can try adding these. You need to first install another supported compiler and then run mex -setup.
Antworten (0)
Kategorien
Mehr zu Simulink Coder finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!