How to fix error "Invalid MEX-file, The specified module could not be found. "
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When I try and run a Simulink this error appears, (for simplicity’s sake I have replaced names and locations with placeholders). Both the MEX file, Simulink and any associated MATLAB code were not created by me and I have limited accesses to the inner workings.
Error while obtaining sizes from MEX S-function 'filename' in 'simulink location'.
Caused by:
Invalid MEX-file 'C:\filepath\filename.mexw64': The specified module could not be found.
I have been poking at this for a while now and have tried several recommended actions to resolve this; downloading a complier (MinGW-w64 C), checking file path (the MEX file is definitely present), installing all add-ons and toolboxes I know I need. I've used MATLAB's dependency analyser, and the MEX file isn't showing up even though they are in the folder being analysed. I have also clumsily used a dependency walker, and nothing looks worrisome but I don’t really trust my skill when using it.
The same setup processes has been followed and completed successfully on other devices, without any extra steps. So, I must admit I'm at a bit of a loss here.
If anyone has any advice, I would love to hear it.
2 comentarios
Walter Roberson
el 30 de Sept. de 2025 a las 20:19
The specified module could not be found typically indicates that a dependancy is unavailable.
dpb
el 1 de Oct. de 2025 a las 15:00
Particularly given OP said "Simulink and any associated MATLAB code were not created by me" it's quite possible the mex file was compiled on a different system or with a different compiler/version. If so, it may have dependencies that are incompatible or missing on the OP's system. In that case, recompiling the mex-file on the target system may be the only recourse.
If have Visual Studio, from the Developer command prompt use
dumpbin /dependents "theMEXfile.mexw64"
and check for all dlls and versions thereof. It's a fair bet the original system uses some compiler-installed runtime DLLs that didn't get moved over.
Respuestas (0)
Ver también
Categorías
Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!