Borrar filtros
Borrar filtros

Mex entry point missing (despite correct entry)

5 visualizaciones (últimos 30 días)
Chris Wolf
Chris Wolf el 12 de Mzo. de 2016
Editada: Chris Wolf el 14 de Mzo. de 2016
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

Respuestas (1)

James Tursa
James Tursa el 12 de Mzo. de 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.
  1 comentario
Chris Wolf
Chris Wolf el 13 de Mzo. de 2016
I did that, and noticed I wasn't linking to all the libraries that matlab is linking to in visual studio. I made the change, but I'm still getting the behavior.
I checked all the include directories, library directories, and libraries. They all match now. Visual studio is compiling to a .dll with the correct output extension, with 64-bit platform selected.
What else should I be looking for in the verbose output? Its a lot of gibberish to me...
thanks for your help so far. I'm at least able to do the compiling in matlab, but it would be much better if I could stick with visual studio for the entire process, as it makes source version control a lot easier.

Iniciar sesión para comentar.

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by