필터 지우기
필터 지우기

Mex entry point missing (despite correct entry)

조회 수: 5 (최근 30일)
Chris Wolf
Chris Wolf 2016년 3월 12일
편집: Chris Wolf 2016년 3월 14일
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

답변 (1개)

James Tursa
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.
  댓글 수: 1
Chris Wolf
Chris Wolf 2016년 3월 13일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by