Welchen Compiler-Befehl verwendet Simulink Coder zum Kompilieren von C/C++-Dateien?

Hier sind einige Compiler-Flags, die Matlab Coder zum Kompilieren der C/C++-Dateien verwendet. Diese sind nützlich, damit Sie überprüfen können, welche Flags für den Build des Codes erforderlich sind.

Matlab 2018b

matlab_compiler_cmd.sh
gcc -c -ansi -pedantic -Wno-long-long -fwrapv -fPIC -O0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=1 -DMAT_FILE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=1 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DRT_MALLOC -DMODEL=my_example -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL -DUNIX -I/home/koeh_ur -I/home/koeh_ur/my_example_grt_rtw -I/opt/matlab/v40/extern/include -I/opt/matlab/v40/simulink/include -I/opt/matlab/v40/rtw/c/src -I/opt/matlab/v40/rtw/c/src/ext_mode/common -o "rt_matrx.o" "/opt/matlab/v40/rtw/c/src/rt_matrx.c"

Dieser Befehl wurde durch Ausführen des Makefiles eines generierten Beispielprojekts gefunden.

Mehr oder weniger wird der gleiche Compiler-Befehl für alle Dateien in diesem Beispiel verwendet.

Linker-Befehl:

matlab_linker_cmd.sh
g++ -Wl,-rpath,"/opt/matlab/v40/bin/glnxa64",-L"/opt/matlab/v40/bin/glnxa64" -o ../my_example rt_matrx.o rt_printf.o rt_logging.o rtGetInf.o rtGetNaN.o rt_nonfinite.o my_example.o my_example_data.o my_example_sfunction.o my_example_sfunction2.o rt_malloc_main.o -lm

Check out similar posts by category: Matlab/Simulink, C/C++