Problem using C API in an application
3 views (last 30 days)
Show older comments
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 Comments
Kaustubha Govind
on 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.
Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!