This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Executable 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.


mexBuild MEX function or engine application


What You Need to Build MEX Files

How to start creating MEX files.

MEX Builds with 64-Bit API by Default

The mex function uses the large-array-handling API.

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.

MinGW-w64 Compiler

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

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.