Main Content

Generated Code Compilation

Specify build process that compiles generated source code and links object code

To produce executable code after source code generation, specify a build process that compiles the generated source code and links object code. You can use a CMake, toolchain, or template makefile approach for building code that you generate from Simulink® models. MATLAB® ships the CMake executable file. Each approach requires the installation of supported build tools. For information about customizing the build process for your development environment, see Code Compilation Customization.

To test numeric equivalence between your model and the generated code, you can use the SIL/PIL Manager.


expand all

codebuildCompile and link generated code (Since R2020b)
slbuildBuild standalone executable file or model reference target for model
rtw_precompile_libsBuild model libraries without building model
getBuildDirGet build folder information from model build information
Simulink.fileGenControlSpecify root folders for files generated by diagram updates and model builds
coder.buildstatus.openOpen Build Status window
coder.buildstatus.closeClose Build Status window




Test Numeric Equivalence Between Model and Generated Code


Troubleshoot Compiler Issues

Identify and fix issues that prevent compiler operation in the build process.