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.

Troubleshoot MEX Files

Common errors creating and using MEX files

If you get runtime errors when you call a MEX file that you did not create, check Version Compatibility and Platform Compatibility. For more help, see the topics in the Runtime Errors section.

If you get errors when trying to compile or link a MEX file, see Getting Help When MEX Fails to diagnose compiler set up and build errors. For more help, see the topics in the Build Errors section.

To help you debug source code, the topics in the Debugging section use MATLAB® example files.

Functions

dbmexEnable MEX-file debugging on UNIX platforms

Topics

Build Errors

Getting Help When MEX Fails

To help diagnose compiler set up and build errors, call the mex function with verbose option -v.

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

Troubleshooting MEX files built with the MinGW-w64 compiler.

Troubleshooting MEX API Incompatibilities

More information for warnings and error messages.

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.

Runtime Errors

Invalid MEX File Errors

What to do when you get an invalid MEX file error.

Version Compatibility

For best results, run MEX files built with your MATLAB version.

Platform Compatibility

If you get a binary MEX file from another source, be sure that the file was compiled for the same platform on which you want to run it.

MEX File Segmentation Fault

What to do when a MEX file causes a segmentation violation or assertion.

MEX File Generates Incorrect Results

What to do when your MEX generates wrong answers.

SDK "macosx10.8" cannot be located Error Message

Error message running a MEX file on Mac platforms.

MEX API Is Not Thread Safe

Do not call a single session of MATLAB on separate threads from a MEX file.

Debugging

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.

Memory Management Issues

Rules for managing mxArray memory.

Debug Fortran MEX Files

These examples show how to debug Fortran MEX files.

MATLAB Supports Fortran 77

MATLAB supports MEX files written in Fortran 77.