Build Engine Applications with IDE - MATLAB & Simulink (original) (raw)
Main Content
You can use the MATLAB® Editor to write your engine application code and the mex
command to build it. If you prefer to use an integrated development environment (IDE) such asMicrosoft® Visual Studio® or Xcode to write your source code, you can still use the mex
command. However, to build your application with your IDE, follow the guidelines in the following topics.
Configuring the IDE
To use your integrated development environment to build engine applications, your IDE needs a compiler that MATLAB supports. For an up-to-date list of supported compilers, see Supported and Compatible Compilers.
Engine applications require the Engine Library libeng
, the Matrix Library libmx
, and supporting include files. When you build using themex
command, MATLAB is configured to locate these files. When you build in your IDE, you must configure the IDE to locate them. Where these settings are depends on your IDE. Refer to your product documentation.
Engine Include Files
Header files contain function declarations with prototypes for the routines you access in the API libraries. These files are in the_`matlabroot`_\extern\include
folder and are the same for Windows®, macOS, and Linux® systems. Engine applications use:
engine.h
— Function prototypes for engine routinesmatrix.h
— Definition of themxArray
structure and function prototypes for matrix access routinesmat.h
(optional) — Function prototypes format
routines
In your IDE, set the pre-processor include path to the value returned by the following MATLAB command:
fullfile(matlabroot,'extern','include')
Engine Libraries
You need the libeng
and libmx
shared libraries. The name of the file is platform-specific. Add these library names to your IDE configuration. Refer to your IDE product documentation for instructions.
Windows Libraries
In these path specifications, replace compiler
with eithermicrosoft
or mingw64
.
- Engine library —
_`matlabroot`_\extern\lib\win64\_`compiler`_\libeng.lib
- Matrix library —
_`matlabroot`_\extern\lib\win64\_`compiler`_\libmx.lib
- MEX library (optional) —
_`matlabroot`_\extern\lib\win64\_`compiler`_\libmex.lib
- MAT-File library (optional) —
_`matlabroot`_\extern\lib\win64\_`compiler`_\libmat.lib
Linux Libraries
- Engine library —
_`matlabroot`_/bin/glnxa64/libeng.so
- Matrix library —
_`matlabroot`_/bin/glnxa64/libmx.so
- MEX library (optional) —
_`matlabroot`_/bin/glnxa64/libmex.so
- MAT-File library (optional) —
_`matlabroot`_/bin/glnxa64/libmat.so
macOS Libraries
Replace macos
with either maca64
for macOS with Apple silicon or maci64
for macOS with Intel®.
- Engine library —
_`matlabroot`_/bin/_`macos`_/libeng.dylib
- Matrix library —
_`matlabroot`_/bin/_`macos`_/libmx.dylib
- MEX library (optional) —
_`matlabroot`_/bin/_`macos`_/libmex.dylib
- MAT-File library (optional) —
_`matlabroot`_/bin/_`macos`_/libmat.dylib