适用于Microsoft Visual C++2008和R2007b的Mex类型
Mex type for Microsoft Visual C++ 2008 and R2007b
我想对vs2008和matlab2007b使用mex类型。我尝试了下面的代码。
#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~1MATLABR2007bsyslcc
[0] None
Compiler:
那么使用mex类型应该怎么做呢?
感谢
我看到两个问题:
- 您不需要包含
<matrix.h>
,<matrix.h>
包含在<mex.h>
中。尝试:include "mex.h"
而不是<mex.h>
,并删除include <matrix.h>
mex -setup
找不到您的Microsoft Visual C++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~1MATLABR2007bsyslcc
[2] Microsoft Visual C++ 2008
[0] None
由于Visual 2008比Matlab R2007b更新,因此Matlab无法自动定位Visual 2008。
有一种方法可以手动添加
请参阅此处:https://www.mathworks.com/matlabcentral/newsreader/view_thread/297616
请考虑:我无法完全验证以下说明,因为我没有Matlab R2007b:
分步说明:
- 转到https://www.mathworks.com/matlabcentral/fileexchange/18508-microsoft-visual-studio-2008-mex-and-mbuild-setup-files
- 下载zip文件VS2008Matlab.zip(按页面右上角的"下载zip"蓝色按钮)
- 提取zip文件
- 将文件夹内容VS2008MATLABMexCompilerFilesX64复制到:
C:Program FilesMATALBR2007bbinwin64mexopts
(假设默认安装文件夹中的版本为64位) - 将文件夹内容VS2008MATLABMBuildCompilerFilesX64复制到:
C:Program FilesMATALBR2007bbinwin64msbuildopts
- 执行
mex -setup
,并验证Visual Studio 2008是否在列表中
相关文章:
- ArduinoJson 6.15.2:JsonObject没有命名类型
- 防止主数据类型C++的隐式转换
- 大量序列中核苷酸类型的快速计数
- 如何从C++中的依赖类型中获得它所依赖的类型
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 是否可以初始化不可复制类型的成员变量(或基类)
- 如何获取std::result_of函数的返回类型
- 从父命名空间重载类型
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 访问者访问变体并返回不同类型时出错
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- C++ 雷神库 - 使用资源加载器类时出现问题(不命名类型)
- 模板元程序查找相似的连续类型名称
- 是否可以从int转换为enum类类型
- 使用 mex 编译库时出错 - __int 64 未命名类型
- c++mex错误:数组下标的类型“double[mwSize]”无效
- 适用于Microsoft Visual C++2008和R2007b的Mex类型