Effacer les filtres
Effacer les filtres

Simulink Coder: Unknown type name mxarray

42 vues (au cours des 30 derniers jours)
Hugo Pontes
Hugo Pontes le 8 Jan 2021
Commenté : Hugo Pontes le 11 Jan 2021
Hello. I have created a custom S Function block that outputs the sum of a user definable number of inputs and it works in simulation. The next step for me is to generate C code from it using Simulink Coder. For now I don't want to inline the S function, I just want to test its autocoded functionality.
When I generate the src and header files and try to build an executable in eclipse I get the following errors:
  • unknown type name 'RTWSfcnInfo' in mymodel.h
  • unknown type name 'mxarray' in mymodel.h,simstruct_def.h, simstruct_internal.h
  • unknown type name '_ResolveVarFcn' ini simstruct_def.h
  • #error unrecognized use in simstruct_compond.h
  • #error unhandled case in simstruct_compond.h
  • #error Must define one of RT, NRT, MATLAB_MEX_FILE, SL_INTERNAL, or FIPXT_SHARED_MODULE in simstruc_compcond.h
I have looked for a solution online and for other people this was solved by including mex.h - I have tried it and it did not work.
Thanks in advance!
  3 commentaires
Mark McBroom
Mark McBroom le 9 Jan 2021
Tip. If you turn on the "verbose build" in your Simulink model and then regenerate code from your model, the compile and link statements will be echoed to the MATLAB output window and you will be able to see all of the compile and link switches. You'll need to define the same compile/link switches in eclipse.
For example:
## TLC code generation complete.
### Creating HTML report file rtwdemo_atomic_codegen_rpt.html
### Using toolchain: Clang v3.1 | gmake (64-bit Mac)
### '/Users/mcbroom/MATLAB-Drive/answers/rtwdemo_atomic_grt_rtw/rtwdemo_atomic.mk' is up to date
### Building 'rtwdemo_atomic': "/Applications/MATLAB_R2020b.app/bin/maci64/gmake" -f rtwdemo_atomic.mk all
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -arch x86_64 -fno-common -fexceptions -mmacosx-version-min=10.14 -O0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DMODEL=rtwdemo_atomic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -I/Users/mcbroom/MATLAB-Drive/answers -I/Users/mcbroom/MATLAB-Drive/answers/rtwdemo_atomic_grt_rtw -I/Applications/MATLAB_R2020b.app/toolbox/rtw/rtwdemos -I/Applications/MATLAB_R2020b.app/extern/include -I/Applications/MATLAB_R2020b.app/simulink/include -I/Applications/MATLAB_R2020b.app/rtw/c/src -I/Applications/MATLAB_R2020b.app/rtw/c/src/ext_mode/common -I/Users/mcbroom/MATLAB-Drive/answers/slprj/grt/_sharedutils -o "rtwdemo_atomic.o" "/Users/mcbroom/MATLAB-Drive/answers/rtwdemo_atomic_grt_rtw/rtwdemo_atomic.c"
xcrun clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -arch x86_64 -fno-common -fexceptions -mmacosx-version-min=10.14 -O0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=0 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DMODEL=rtwdemo_atomic -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -I/Users/mcbroom/MATLAB-Drive/answers -I/Users/mcbroom/MATLAB-Drive/answers/rtwdemo_atomic_grt_rtw -I/Applications/MATLAB_R2020b.app/toolbox/rtw/rtwdemos -I/Applications/MATLAB_R2020b.app/extern/include -I/Applications/MATLAB_R2020b.app/simulink/include -I/Applications/MATLAB_R2020b.app/rtw/c/src -I/Applications/MATLAB_R2020b.app/rtw/c/src/ext_mode/common -I/Users/mcbroom/MATLAB-Drive/answers/slprj/grt/_sharedutils -o "rt_main.o" "/Applications/MATLAB_R2020b.app/rtw/c/src/common/rt_main.c"
### Creating standalone executable ../rtwdemo_atomic ...
xcrun clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -Wl,-rpath,/Applications/MATLAB_R2020b.app/bin/maci64 -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/.. -L"/Applications/MATLAB_R2020b.app/bin/maci64" -o ../rtwdemo_atomic rtwdemo_atomic.o rt_main.o
### Created: ../rtwdemo_atomic
Hugo Pontes
Hugo Pontes le 11 Jan 2021
Thanks Mark for you reply. I couldn't figure out how to correct it but I went and tried to inline by wrapping the S function and now it works as it should and it is supposedly better optimized

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by