What compiler command does Simulink Coder use to compile C/C++ files?
Here are some compiler flags Matlab Coder uses to compile the C/C++ files. These are useful so you can check out which flags are required for the code to build.
Matlab 2018b
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"
This command has been found by running the makefile of a generated example project.
More or less the sample compiler command is used for all files in this example.
Linker command:
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