Mex entry point missing (despite correct entry)
2 次查看(过去 30 天)
显示 更早的评论
I'm getting the mex entry point missing error with a compiled cpp program. Here's the cpp:
#include "stdafx.h"
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
plhs[0] = mxCreateString("hello world");
}
The entry function name and arguments seem fine to me, unless I'm missing something. It compiles fine using visual studio 2015 and VC++ compiler. What could be causing this?
Thanks in advance
edit:
When I compile it within visual studio, I get the entry mex file missing. When I compile it using 'mex' in matlab 2015b (using the same compiler as used in visual studio) it works. Given that it is the same compiler, what could be the difference?
edit 2:
Figured it out eventually. I didn't create the .def file that I guess is necessary. Right click on your project, go to add, select code and .def file. Fill out the file as shown in:
except replace MYFILE with the name of the output file, including the extension. Something like:
LIBRARY "MyProgram.mexw64" EXPORTS mexFunction
0 个评论
回答(1 个)
James Tursa
2016-3-12
Do the mex compile at the command line with the verbose option, then look at how it is being compiled and everything that is getting linked in and compare that with what you are doing.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!