Linker error 2019 while compiling mex on matlab 2015b 64bit

조회 수: 4 (최근 30일)
Anna Shtengel
Anna Shtengel 2016년 1월 5일
답변: mariem jebri 2016년 8월 24일
Hi, I'm using Matlab2015b 64bit with compiler of Microsoft Visual C++ 2015. I'm trying to create a mex having a c interface funtction which calls a function myfunc_cpp inside, which is in the same folder:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
which is in the file mymexfilefunc.cpp. The matlab command I used:
mex mymexfilefunc.cpp
I don't think I missed any libs. I got the following error:
Error using mex Creating library mymexfilefunc.lib and object mymexfilefunc.exp mymexfilefunc.obj : error LNK2019: unresolved external symbol "void __cdecl myfunc_cpp(...)" ...referenced in function "void __cdecl mexFunction(int,struct mxArray_tag * * const,int,struct mxArray_tag * * const)"... mymexfilefunc.mexw64 : fatal error LNK1120: 1 unresolved externals

채택된 답변

Anna Shtengel
Anna Shtengel 2016년 1월 5일
I found a solution - compile the project in Release and add all the .obj that are created, which are used through the mexFunction to the command with their fullpath:
mex pathobj1\obj1.obj pathobj2\obj2.obj mymexfilefunc.cpp

추가 답변 (1개)

mariem jebri
mariem jebri 2016년 8월 24일
hi can someone plz help me adding visual studio 2012 compiler to matlab 2015b ? tnx

카테고리

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