i want to use mex type for vs2008 and matlab2007b.i tried code below.
#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");
}
and get this error
'matrix.h': No such file or directory
and i wrote below in matlab commond win
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:
so what is should do to use mex type?
thanks
I see two problems:
<matrix.h>
, <matrix.h>
is included inside <mex.h>
. Try: include "mex.h"
instead of <mex.h>
, and remove include <matrix.h>
.mex -setup
could not locate your Microsoft Visual C++ 2008 compiler. The selection menu should look as follows:
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
Since Visual 2008 is newer than Matlab R2007b, Matlab can't automatically locate Visual 2008.
There is a way to add it manually.
Refer here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/297616
Please consider: I could not fully verify the following instructions because I don't have Matlab R2007b:
Step by step instructions:
C:\Program Files\MATALB\R2007b\bin\win64\mexopts
(assuming your version is 64 bit in default installation folder).C:\Program Files\MATALB\R2007b\bin\win64\msbuildopts
mex -setup
, and verify Visual Studio 2008 is in the list.