Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Invalid MEX File Errors

If MATLAB® cannot find all .dll files referenced by a MEX file, it cannot load the MEX file. For example, suppose MEX file A depends on library subA.dll which is not on the system path. If you call A.mexw64 in folder L:\mylibs\, MATLAB displays:

Invalid MEX-file 'L:\mylibs\A.mexw64':
Missing dependent shared libraries
'subA.dll' required by 'L:\mylibs\A.mexw64'

If a symbol required by a shared library is missing, MATLAB displays a message similar to the following:

Invalid MEX-file 'L:\mylibs\A.mexw64':
Missing symbol 'q' in 'L:\mylibs\subA.dll' required by L:\mylibs\A.mexw64'

To find library dependencies:

  • On Windows® systems, download the Dependency Walker utility from the website http://www.dependencywalker.com.

  • On Linux® systems use:

    ldd -d libname.so
  • On macOS systems use:

    otool -L libname.dylib

For .dll files that the MEX file linked against when it was built, the .dll files must be on the system path or in the same folder as the MEX file.

MEX files might require additional libraries that are not linked to the MEX file. Failure to find one of these explicitly loaded libraries might not prevent a MEX file from loading, but prevents it from working correctly. The search path used to find these explicitly loaded libraries is controlled by the code that loads the libraries and might not include the folder that contains the MEX file. Consult the library documentation on proper installation locations.

Possible reasons for failure include:

  • MATLAB version incompatibility. For more information, see Version Compatibility.

  • Missing compiler runtime libraries. If your system does not have the same compiler that built the MEX file, see the Microsoft® MSDN® website for information about Visual C++® Redistributable Packages.

  • Missing or incorrectly installed specialized runtime libraries. Contact your MEX file or library vendor.

Related Topics

External Websites

Was this topic helpful?