Main Content

Build Process

Set up compiler or IDE, configure and initiate build process, troubleshoot compiler errors

Before you build an executable program or shared library for a model, choose and set up a compiler or IDE and configure the target environment. Several methods are available for initiating the build process. Tooling is available for reloading, rebuilding, and relocating generated code.

To improve code execution, consider using available profiling capabilities.


expand all

packNGoPackage generated code in ZIP file for relocation
rtw_precompile_libsRebuild precompiled libraries within model without building model
codebuildCompile and link generated code
rtwrebuildRebuild generated code from model
slbuildBuild standalone executable file or model reference target for model
coder.buildstatus.closeClose Build Status window
coder.buildstatus.openOpen Build Status window
RTW.getBuildDirGet build folder information from model build information
Simulink.fileGenControlSpecify root folders for files generated by diagram updates and model builds
switchTargetSelect target for model configuration set


Build Process Workflows

Approaches for Building Code Generated from Simulink Models

Choose CMake, toolchain, or template makefile approach for building generated code.

Build Process Workflow for Real-Time Systems

Generate C code from a model and build an executable program.

Build Models from a Windows Command Prompt Window

Build models by running MATLAB with a batch file.

Rebuild a Model

Rebuild a model after customizing generated source code or makefiles.

Reload Generated Code

Reload generated code from the Model Explorer.

Build Integrated Code Within the Simulink Environment

Add support files and control model code generation and builds within the Simulink Environment.

Relocate Code to Another Development Environment

Use code generation and packaging options to relocate code and artifacts to another development environment.

Compile and Debug Generated C Code with Microsoft® Visual Studio®

Build a Visual Studio® Solution from a model.

Configure Build Process

Configure Toolchain or Template Makefile Build Process

Build executable programs from generated code.

Template Makefiles and Make Options

Template makefiles that are built into the code generator.

Select C or C++ Programming Language

Choose C or C++ as the programming language for code generation.

Select and Configure C or C++ Compiler

Consider programming language compliance for generated code and select a compiler for the build process.

Troubleshoot Compiler Issues

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

Run-Time Environment Configuration

Select and configure the target environment for your application

Reports for Code Generation

Access the generated code files and information about the generated code with the code generation report.

Configure Model for Debugging

Configure a model so that generated code and the build process are set for debugging.

Build Process Considerations

Manage Build Process Folders

Manage folders that the code generator creates.

Manage Build Process Files

Work with generated source files and dependency files that the code generator produces.

Manage Build Process File Dependencies

Work with generated source files and dependency files that the code generator produces.

Add Build Process Dependencies

Add dependency information for external code to the build process.

Build Process Support for Folder Names

Troubleshoot build process errors that occur when file system issues prevent file processing.

Executable Program Generation

Build executable programs with the code generator.