如何在matlab中找到mex的编译器?

时间:2016-03-28 16:50:38

标签: windows matlab windows-10 mex

我想从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 中。但是在安装时我遇到了一些问题,但仍在继续。

enter image description here

  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 Files(x86)\ Microsoft Visual Studio 10.0"            但要么该目录不存在,要么配置            无效。

8。我已经从我的电脑上卸载了visual studio,并且该目录仍然存在  有没有简单的方法从matlab运行c文件或如何为mex文件安装编译器?

编辑:我现在发现的是来自此link的Windows 10的Windows软件开发工具包(SDK)并下载它。我不知道它会起作用吗?

1 个答案:

答案 0 :(得分:0)

我不记得有多少次我用惊人的MEX文件关闭了。以下方式耗时但有效。

  1. 从您的计算机上卸载Visual Studios和SDK。
  2. 从“API
  3. 中查找受支持的Visual Studio版本
  4. 使用默认目录在此Visual Studios中安装C ++和相关库。不要试图自己选择库。
  5. 运行'mex -setup',让它找到编译器。
  6. 整个过程将用一整个上午好运。