Choose a C++ Compiler - MATLAB & Simulink (original) (raw)
Main Content
MATLAB® chooses a default compiler for building MEX files, a MATLAB interface to a C++ library, and standalone MATLAB engine and MAT-file applications. The default compiler for C++ applications might be different from the default compiler for C applications. To see the default C++ compiler, type one of these commands:
mex -setup cpp mex -setup CPP mex -setup c++
MATLAB also displays links to other C++ compilers on your system, if any. To change the default, select one of these links.
When you type this command, MATLAB shows you information for the default C compiler only.
Select Microsoft Visual Studio Compiler
This example shows how to determine and change the default compiler for building C++ applications when you have multiple versions ofMicrosoft® Visual Studio® on your system.
To display information for the C++ compilers installed on your system, type:
To change the default, click one of the links. MATLAB displays information about this compiler, which remains the default until you call mex -setup cpp
to select a different default.
Select MinGW-w64 Compiler
If you only have the MinGW® compiler installed on your system, MATLAB automatically chooses MinGW for both C and C++ applications. If you have multiple C or C++ compilers, type this command to choose a C compiler.
Type this command to choose a C++ compiler.
If you only type mex -setup
and choose MinGW, when you compile a C++ file, mex
might choose a different compiler.
See Also
mex | clibgen.generateLibraryDefinition