【问题标题】:How to locate compiler for mex in matlab?如何在 matlab 中找到 mex 的编译器?
【发布时间】:2016-03-28 16:50:37
【问题描述】:

我想从 Matlab 运行 c 代码。所以我开始谷歌,看到使用mex,我可以实现它。但我在 matlab 中运行 mex 时遇到问题。这是我所做的:

1. 起初我在 matlab 命令窗口中运行 mex -setup

2. 然后我得到了以下回复。

请选择您的编译器来构建 MEX 文件:
您想让 mex 找到已安装的编译器 [y]/n 吗?

3.我写了y并得到以下回复

在这台计算机上找不到受支持的 SDK 或编译器。对于列表 支持的编译器,请参阅
http://www.mathworks.com/support/compilers/R2013a/win64.html

4.我转到链接并下载了 sdk 并将其安装在我的 windows 10 中。但是在安装时我遇到了一些问题但继续。



5. 再次重复整个过程并写了y,但收到与上述相同的消息.

6. 然后我尝试写n 并查看了我的所有编译器列表。

[1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker) 
[2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker) 
[3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker) 
[4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker) 
[5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker) 
[7] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[8] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker) 
[9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker) 
[10] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker) 
[11] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker) 
[12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker) 
[13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[14] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker) 
[15] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker) 
[16] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker) 
[17] Microsoft Software Development Kit (SDK) 7.1
[18] Microsoft Visual C++ 2005 SP1 
[19] Microsoft Visual C++ 2008 SP1 
[20] Microsoft Visual C++ 2010 
[21] Microsoft Visual C++ 2012 

7.数字17是我安装的sdk。所以我在选择 17 后得到了回应。

警告:Microsoft 软件开发工具包的默认位置 (SDK) 编译器是: “C:\Program 文件 (x86)\Microsoft Visual Studio 10.0” 但要么该目录不存在,要么配置 无效。

8.我已经从我的计算机上卸载了 Visual Studio,并且该目录仍然存在

有没有简单的方法可以从 matlab 运行 c 文件或如何安装编译器mex 文件??

编辑:现在我从link 找到了适用于 Windows 10 的 Windows 软件开发工具包 (SDK) 并下载它。不知道行不行??

【问题讨论】:

  • 从您的问题中不清楚您是要调用已编译的 dll(例如),还是要编译 mex 文件。它是哪一个?另外,步骤7中的错误引用的目录是否存在?如果没有,您在哪里安装了 SDK?
  • 是的,该目录存在,但我很久以前就卸载了 Visual Studio。我想编译一个存在于 mex 目录中的 c 文件,并希望从 matlab 文件中使用该 c 文件。当我看到我无法在 matlab 中编译那个 c 文件时,我开始寻找它
  • 这是The MathWorks installation info for the SDK 的链接。请注意,即使它显示的是 windows 7,您也需要该 SDK。
  • 是的,我通过此链接安装了 sdk。
  • 并得到这样的错误social.msdn.microsoft.com/Forums/vstudio/en-US/… 现在我正在尝试做这篇文章的第二个答案,并希望能得到任何简单的解决方案

标签: windows matlab windows-10 mex


【解决方案1】:

我不记得我用引人注目的 MEX 文件关闭了多少次。以下方法虽然耗时但有效。

  1. 从您的计算机上卸载 Visual Studio 和 SDK。
  2. 从“https://www.mathworks.com/support/compilers.html”查找受支持的 Visual Studio 版本
  3. 在此 Visual Studio 中使用默认目录安装 C++ 和相关库。不要试图自己选择库。
  4. 运行“mex -setup”,让它找到编译器。

如果运气好的话,整个过程会用掉一整个上午。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-23
    • 2014-05-29
    • 2015-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多