本文介绍了Matlab mex“缺少依赖的共享库"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Matlab 2017a中创建了几个mex文件.当我使用Visual Studio C ++ 2017编译它们时,它们在我的计算机上运行良好.但是,当我尝试在另一台计算机上使用它们时,出现错误消息

I have a couple mex files I'm creating in Matlab 2017a. When I compile them with Visual Studio C++ 2017, they run fine on my computer. However, when I attempt to use them on another computer, I get an error that says

Error using mfss_mex.filter_uni
Invalid MEX-file  
'path_to_mex_file\mexfile.mexw64':
Missing dependent shared libraries:
'MSVCP140.dll' required by
'path_to_mex_file\mexfile.mexw64'
'VCRUNTIME140.dll' required by
'path_to_mex_file\mexfile.mexw64'

我想我可以通过在将要运行的每台计算机上安装Visual Studio运行时来解决此问题,但我想避免这种情况.有没有办法使用Visual Studio C ++编译器来编译这些mex文件并避免这些依赖关系?

I think I could resolve this by installing the Visual Studio runtime on every computer this will get run on but I'd like to avoid that. Is there a way to compile these mex files and avoid these dependencies with the Visual Studio C++ compiler?

推荐答案

Mathworks 解决方案的解决方案是在有此问题的任何计算机上安装C ++编译器运行时.

The Mathworks solution to this is to install the C++ compiler runtime on any computer that has this issue.

我发现我只需要将有问题的.dll文件(MSVCP140.dllVCRUNTIME140.dll)复制到与我的.mexw64文件相同的文件夹中,一切就不会有问题.

I found that I simply needed to copy the offending .dll files (MSVCP140.dll and VCRUNTIME140.dll) into the same folder with my .mexw64 files and everything ran without a problem.

这篇关于Matlab mex“缺少依赖的共享库"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:01