【发布时间】:2014-12-09 16:22:05
【问题描述】:
首先我想编译 MatConvNet 库以便在本教程的 windows 中使用 (Compiling MatConvNet on Windows) 但我不能。然后我认为最好编译一个非常简单的文件,然后再编译库。
我有 Matlab R2013a 64 位 和 Visual Studio 2010 64 位。
我的程序 Test.cpp
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
{
printf("Hello! :)\n");
}
我可以用 mex Test.cpp 在 matlab 中编译 Test.cpp 当我输入 test 输出是 Hello! :)
我也可以按照下面的教程设置正确的配置,编译不会出错。
1)http://coachk.cs.ucf.edu/GPGPU/Compiling_a_MEX_file_with_Visual_Studio2.htm
2)http://www.orangeowlsolutions.com/archives/490
但是当我在 Matlab 中运行它时,什么也没有发生。没有输出,Matlab 没有给我任何错误。
有什么问题?
请注意:
在 (1) 中,第二步是将“matlab\extern\include”中的“mexversion.rc”添加到项目中但是这个文件在我的计算机中不存在,所以我做不到。
-
在 Visual Studio 中,我需要在下面添加两个头文件来编译程序。
包括“stdafx.h”
包括“maxrix.h”
所以 Visual Studio 中的 Test.cpp 是:
#include "mex.h"
#include "stdafx.h"
#include "matrix.h"
void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
{
printf("Hello! :)\n");
}
【问题讨论】:
标签: matlab visual-studio 64-bit mex