Error: Invalid MEX file, the specified module could not be found

会有一股神秘感。 提交于 2019-11-30 23:10:33

问题


I have compiled Mex file successfully on my laptop. But when I am running it, it says Invalid mex file 'c:\newfolder\filename.mexw32' The specified module could not be found.

System specification:  
OS: windows 7  
MATLAB 2010a  
Microsoft Visual Studio 2008.  

The same mex file is compiled and run successfully on my PC under XP SP3.


回答1:


This MathWorks support link suggests two possible reasons to your problem:

  1. You do not have all of the necessary libraries that the MEX-function is dependent upon.
  2. You are running a MEX-file on a different version of MATLAB than it was compiled on.

Either way, to locate the source of this error it says that you need to list all dependent library files and verify their existence in the system you're trying to run the MEX file on, and also recommends the Dependecy Walker as the tool to to do that.




回答2:


Do you you the mex file on another system than the one it is created on?

If so, then you need to install the Microsoft Visual C++ Redistributable on that machine.




回答3:


I had this problem also when upgrading from Matlab2010a/VS2008 to Matlab2013a/VS2010.

All my environment variables were sent correctly. A reboot fixed problems with OpenCV dlls not being found, I assume that it was still trying to link to the OpenCV dlls for VS2008 (even though I had changed the path). However still my mex file could not find libmex.dll.

When I installed Matlab2013a, I did not uninstall the old version (in case I wanted to go back). However that was the cause of my problem. Once I uninstalled the old version of Matlab and rebooted again, the problem was gone.




回答4:


I had a similar problem. I was only linking against 1 'lib' so I simply copied that lib into the same folder as the mexw64 and it worked.

I have not poked around for the correct place to tell MATLAB to add the lib's real location to whatever path it's looking at.



来源:https://stackoverflow.com/questions/15338427/error-invalid-mex-file-the-specified-module-could-not-be-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!