Using MATLAB® Coder™, you can generate platform-specific MEX functions, C/C++ static and dynamic libraries, and C/C++ executable programs. If you specify C++, MATLAB Coder wraps the C code into .cpp files so that you can use a C++ compiler and interface with external C++ applications. It does not generate C++ classes.
To learn how to generate... | See... |
---|---|
C/C++ static libraries from your MATLAB code | Generating C/C++ Static Libraries from MATLAB Code |
C/C++ dynamic libraries from your MATLAB code | Generating C/C++ Dynamically Linked Libraries from MATLAB Code |
C/C++ executables from your MATLAB code | Generating Standalone C/C++ Executables from MATLAB Code |
MEX functions from your MATLAB code | Generate MEX Functions by Using the MATLAB Coder App |
If errors occur, MATLAB Coder does not generate code, but produces an error report and provides a link to this report. For more information, see Code Generation Reports.
In addition to your MATLAB file, you can specify the following types of custom files to include in the build for standalone C/C++ code generation.
File Extension | Description |
---|---|
.c | Custom C file |
.cpp | Custom C++ file |
.h | Custom header file |
.o , .obj | Custom object file |
.a , .lib , .so , .dylib | Library |
.tmf | Template makefile for custom MATLAB Coder builds |