This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Executable C/C++ MEX Files

Build C/C++ subroutines into MATLAB® functions

To help you configure your system using a sample MEX file, see Build MEX File. For information about writing a MEX file, see Create C Source MEX File.


mex Build MEX function from C/C++ or Fortran source code
dbmex Enable MEX-file debugging (on UNIX platforms)
mex.getCompilerConfigurations Get compiler configuration information for building MEX files


What You Need to Build MEX Files

How to start creating MEX files.

Build MEX File

This example shows how to build the example MEX file, timestwo.

Choose a C++ Compiler

How to set up a C++ compiler.

Install MinGW-w64 Compiler

How to use the MinGW-w64 compiler to build MEX files.

Compiling MEX Files with the Microsoft Visual C++ IDE

How to compile MEX files in the Microsoft® Visual C++® IDE

Change Default Compiler

How and when to change the default compiler.

Custom Build with MEX Script Options

Customizing the MEX build process.


Debug on Microsoft Windows Platforms

This example shows how to debug a MEX file with Microsoft Visual Studio®.

Debug on Mac Platforms

This example shows how to debug a MEX file on Mac Platforms.

Debug on Linux Platforms

This example shows how to debug a MEX file on Linux® Platforms.

Compiling MEX File Fails

What to do when compiling a MEX file fails.

Symbol mexFunction Unresolved or Not Defined

Every MEX file needs a mexFunction.

Troubleshooting and Limitations Compiling C/C++ MEX Files with MinGW-w64

Troubleshooting MEX files built with the MinGW-w64 compiler.

SDK "macosx10.8" cannot be located Error Message

Error message running a MEX file on Mac platforms.

Was this topic helpful?