我想将mex类型用于vs2008和matlab2007b.i下面的尝试代码。
#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");
}得到这个错误
'matrix.h': No such file or directory我在下面的matlab中写了“常胜”
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类型应该做些什么呢?
谢谢
发布于 2016-07-26 12:10:19
我看到两个问题:
<matrix.h>,<matrix.h>包含在<mex.h>中。尝试:include "mex.h"而不是<mex.h>,并删除include <matrix.h>。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:
逐步说明:
C:\Program Files\MATALB\R2007b\bin\win64\mexopts (假设默认安装文件夹中的版本为64位)。C:\Program Files\MATALB\R2007b\bin\win64\msbuildoptsmex -setup,并验证Visual 2008在列表中。https://stackoverflow.com/questions/38583411
复制相似问题