Generate Interface to school
Library
Verify Selected C++ Compiler
You can use any C++ compiler supported by MathWorks. To verify that you have a C++ compiler, type:
mex -setup cpp
This example uses the MinGW64 compiler.
Generate Definition File
Identify the name and path to the C++ library artifacts. By default, the function uses
the name of the header file (school
) as the name of the library
(libname
).
productPath = fullfile(matlabroot,'extern','examples','cpp_interface'); hppFile = 'school.hpp';
Generate the library definition file. MATLAB® creates the definition file defineschool.mlx
.
clibgen.generateLibraryDefinition(fullfile(productPath,hppFile), ... "OverwriteExistingDefinitionFiles",true)
Open Definition File
Open the generated definition file in Live Editor by clicking the link in the output message. Then continue with the next step.