Invalid MEX-file '....mexw64': The specified module could not be found..

267 views (last 30 days)
Hi,
I need to run a code in matlab which use a mexw64 file. However I have this error:
"Invalid MEX-file '...\MexFileName.mexw64': The specified module could not be found"
I have Matlab 2016b and Windows 10
Also installed SDK 7.1 and run mex-setup :
mex -setup
MEX configured to use 'Microsoft Windows SDK 7.1 (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
can you help me with this?

Answers (1)

Walter Roberson
Walter Roberson on 12 Jul 2020
"Invalid MEX-file '...\MexFileName.mexw64': The specified module could not be found"
That typically means that the .mexw64 file refers to a DLL that is not available.
The output you show for mex -setup is fine. The bit about changing code is a warning about old code that uses 32 bit pointers; if you have sufficiently old code then you might need to update the code.
The next step would be to rebuild the .mexw64 file by using the "mex" command with the source code. In many cases that is just
mex NameOfFile.c
https://www.mathworks.com/help/matlab/ref/mex.html -- ignore the -r2017b and -r2018a flags and interleaved complex you see there: those are changes that are after your release.
If your code uses a DLL you might need the information in https://www.mathworks.com/help/matlab/ref/mex.html#btx0rai-1 Specify Path to Library File, unless the dll happens to be in the same directory as you are compiling in.
  2 Comments
hirad shimi
hirad shimi on 13 Jul 2020
thank you for answer.
Unfortunately I have a new problem for running a .cpp file:
mex file_name.cpp
Building with 'Microsoft Windows SDK 7.1 (C++)'.
Error using mex
file_name.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\intrin.h(26) : fatal error C1083: Cannot open include
file: 'ammintrin.h': No such file or directory
can you help me with this?

Sign in to comment.

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!