首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Microsoft Visual C++ 2008和R2007b的Mex类型

Microsoft Visual C++ 2008和R2007b的Mex类型
EN

Stack Overflow用户
提问于 2016-07-26 07:17:17
回答 1查看 240关注 0票数 2

我想将mex类型用于vs2008和matlab2007b.i下面的尝试代码。

代码语言:javascript
复制
#include<iostream>
#include <matrix.h>
#include<mex.h>
using namespace std;
void hello(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  mexPrintf("Hello World!\n");
}

得到这个错误

代码语言:javascript
复制
'matrix.h': No such file or directory

我在下面的matlab中写了“常胜”

代码语言:javascript
复制
mex -setup
Please choose your compiler for building external interface (MEX) files: 

Would you like mex to locate installed compilers [y]/n? y

Select a compiler: 
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2007b\sys\lcc 

[0] None 

Compiler: 

那么使用mex类型应该做些什么呢?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-26 12:10:19

我看到两个问题:

  1. 您不需要包括<matrix.h><matrix.h>包含在<mex.h>中。尝试:include "mex.h"而不是<mex.h>,并删除include <matrix.h>
  2. mex -setup无法找到您的MicrosoftVisualC++ 2008编译器。

选择菜单应如下所示:

Please choose your compiler for building external interface (MEX) files:

Would you like mex to locate installed compilers [y]/n? y

Select a compiler:

[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2007b\sys\lcc

[2] Microsoft Visual C++ 2008

[0] None

由于Visual2008比Matlab R2007b更新,所以Matlab不能自动定位Visual2008。

有一种方法可以手动添加它。

请参阅此处:thread/297616

请考虑:我无法完全验证以下说明,因为我没有Matlab R2007b:

逐步说明:

  1. 转到https://www.mathworks.com/matlabcentral/fileexchange/18508-microsoft-visual-studio-2008-mex-and-mbuild-setup-files
  2. 下载zip文件VS2008Matlab.zip (按页面右上角的“下载zip”蓝色按钮)。
  3. 解压缩压缩文件。
  4. 将文件夹内容VS2008MATLABMexCompilerFilesX64复制到:C:\Program Files\MATALB\R2007b\bin\win64\mexopts (假设默认安装文件夹中的版本为64位)。
  5. 将文件夹内容VS2008MATLABMBuildCompilerFilesX64复制到:C:\Program Files\MATALB\R2007b\bin\win64\msbuildopts
  6. 执行mex -setup,并验证Visual 2008在列表中。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38583411

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档