How to fix error "Invalid MEX-file, The specified module could not be found. "
32 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2025-9-30,20:19
The specified module could not be found typically indicates that a dependancy is unavailable.
dpb
2025-10-1,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.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!