Main Content

Build Configuration

Configuration of build settings such as output file name, location, type, language

To control and configure the build process for generating binary code, there are many parameters and settings. These settings control attributes such as the output build type (MEX, lib, dll, or exe) and C versus C++ language. Other build settings enable you to customize the build output according to specific needs, such as readability, performance, and external code integration. You can modify the build options in the code generation configuration object from the app or from the command line. You can create the configuration object by using coder.config. Open the object in the editing app by using open. To specify additional build files and flags from inside your function code, use coder.updateBuildInfo.


target.AliasCreate alternative identifier for target feature object
target.LanguageImplementationProvide C and C++ compiler implementation details
target.ObjectBase class for target feature classes
target.ProcessorProvide target processor information
coder.ExternalDependencyInterface to external code


coder.configCreate MATLAB Coder code generation configuration objects
coder.updateBuildInfoUpdate build information object RTW.BuildInfo
target.addAdd target feature object to MATLAB memory
target.createCreate target feature object
target.exportExport target feature data
target.getRetrieve target feature objects from MATLAB memory
target.removeRemove target feature object from MATLAB memory
target.upgradeUpgrade existing definitions of hardware devices


coder.MexCodeConfigConfiguration parameters for MEX function generation from MATLAB code
coder.CodeConfigConfiguration parameters for C/C++ code generation from MATLAB code
coder.EmbeddedCodeConfigConfiguration parameters for C/C++ code generation from MATLAB code with Embedded Coder
coder.HardwareImplementationHardware-specific configuration parameters for C/C++ code generation from MATLAB code
coder.hardwareCreate hardware board configuration object for C/C++ code generation from MATLAB code
coder.ReplacementTypesConfiguration parameter to specify custom names for MATLAB built-in data types in C/C++ code generation


targetManage target hardware information


Build Configuration Basics

Configure Build Settings

Configure build configuration parameters at the command line or in the MATLAB® Coder™ app.

Build Process Customization

Control aspects of the build process that occur after code generation but before compilation.

Paths and File Infrastructure Setup

Specify location of custom code.

Share Build Configuration Settings

Export project settings to a code generation configuration object or import the settings into a project.

C Compiler Considerations for Signed Integer Overflows

For accurate results from signed integer C operations, the C compiler must preserve wrap-on-overflow behavior.

Requirements for Signed Integer Representation

Compile generated code on a target that uses a two’s complement representation for signed integer values.

Specific Build Options

Preserve Variable Names in Generated Code

Improve readability of generated C/C++ code by preserving your variable names in the generated code.

How MATLAB Coder Partitions Generated Code

Select file partitioning method.

Change the Standard Math Library

For calls to math operations, the code generator uses the standard math library that you specify in the build settings.

Specify Data Types Used in Generated Code

Generate built-in C types or MathWorks® predefined types.

Register New Hardware Devices

Extend the range of supported hardware by registering new devices.


Compiler and Linker Errors

Address common causes of errors that occur during build.