MEX error LNK2019: unresolved external symbol
Show older comments
Hi everybody,
I need to fix a matlab program that incorporates C code compiled to a mex function. It is likely that the mex functions stopped working when updating Matlab from 32bit to 64bit.
when trying to recompile the c code into a mex file I get the following error:
mex qpip.c
qpip.obj : error LNK2019: unresolved external symbol qpip_sub referenced in function mexFunction
qpip.obj : error LNK2019: unresolved external symbol dcopy referenced in function mexFunction
qpip.mexw64 : fatal error LNK1120: 2 unresolved externals
I did not write the program myself but I should have all the necessary files. The qpip_sub.c and qpip_sub.h and some other files are in the same folder. The dcopy function seems to be part of the the BLAS linear algebra package but I only seem to have blasmap.h.
Any ideas what is going wrong? Thanks for the help!
(using MSVS2010, MATLAB R2011b, 64bit Windows 7)
Accepted Answer
More Answers (1)
Ingo Hermann
on 8 Nov 2017
I have a similar problem with the error:
mex mexFitFunctions.c
Building with 'Microsoft Windows SDK 7.1 (C)'.
Error using mex
LINK : error LNK2001: unresolved external symbol mexFunction
mexFitFunctions.lib : fatal error LNK1120: 1 unresolved externals
I tried the stuff from aboth but get the same error.
3 Comments
Ingo Hermann
on 8 Nov 2017
And my real problem is in that mex file:
Building with 'Microsoft Windows SDK 7.1 (C)'.
cl /c /GR /W3 /EHs /nologo /MD -I"(D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\levmar-2.6)" -I"(D:\IngoHermann\MATLAB\external\include)" -I"(D:\IngoHermann\MATLAB\simulink\include)" /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /USE_LIBCMT=0 /Z7 D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\mexT1Mapping.c /FoC:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexT1Mapping.obj
mexT1Mapping.c
D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\mexT1Mapping.c(49) : warning C4013: 'strcmp' undefined; assuming extern returning int
cl /c /GR /W3 /EHs /nologo /MD -I"(D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\levmar-2.6)" -I"(D:\IngoHermann\MATLAB\external\include)" -I"(D:\IngoHermann\MATLAB\simulink\include)" /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /USE_LIBCMT=0 /Z7 D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\mexFitFunctions.c /FoC:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexFitFunctions.obj
mexFitFunctions.c
d:\ingohermann\matlab\t1tool\t1recotool\mexresources\mexfitfunctions.c(289) : warning C4789: destination of memory copy is too small
cl /c /GR /W3 /EHs /nologo /MD -I"(D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\levmar-2.6)" -I"(D:\IngoHermann\MATLAB\external\include)" -I"(D:\IngoHermann\MATLAB\simulink\include)" /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /USE_LIBCMT=0 /Z7 D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\mexUtils.c /FoC:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexUtils.obj
mexUtils.c
link /nologo /manifest /DLL /debug /PDB:"mexT1Mapping.mexw64.pdb" /EXPORT:mexFunction C:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexT1Mapping.obj C:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexFitFunctions.obj C:\Users\ih11\AppData\Local\Temp\mex_193841985824822_4328\mexUtils.obj D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\levmar-2.6\levmar.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\clapack.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\BLAS.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\BLAS_nowrap.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\libf2c.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\f77blaswrap.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\cblaswrap.lib D:\IngoHermann\MATLAB\T1Tool\T1RecoTool\MexResources\CLAPACK\lib\x64\tmglib.lib /LIBPATH:"D:\IngoHermann\MATLAB\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /out:mexT1Mapping.mexw64
Error using mex
Creating library mexT1Mapping.lib and object mexT1Mapping.exp
mexT1Mapping.obj : error LNK2019: unresolved external symbol maxAbsArray referenced in function threadFunc
mexFitFunctions.obj : error LNK2019: unresolved external symbol dlevmar_der referenced in function wrapFunctionT2
mexFitFunctions.obj : error LNK2019: unresolved external symbol dlevmar_dif referenced in function
wrapFunctionSASHA
mexFitFunctions.obj : error LNK2019: unresolved external symbol minAbsArray referenced in function
wrapFunctionSAPPHIREPre
mexFitFunctions.obj : error LNK2019: unresolved external symbol dlevmar_bc_der referenced in function
wrapFunctionShMOLLI
mexT1Mapping.mexw64 : fatal error LNK1120: 5 unresolved externals
BABANBHAIGARI SHAFIULLAH
on 13 Mar 2020
I am facing similar error, did you get the answer for this. Please let me know how to resolve this issue.
Thomas
on 18 Oct 2022
Hi ! I am updating this post as I am facing the same issue as Ingo.
Did someone manage to get through it ?
Thank you
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!