Mex entry point missing (despite correct entry)
4 views (last 30 days)
Show older comments
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 Comments
Answers (1)
James Tursa
on 12 Mar 2016
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.
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!