unresolved external symbol mxDestroyArray referenced in function mexFunction
显示 更早的评论
Hi All I am integrating MATLAB to run cuda prog via MEX interface. It runs fine with following combination 1.MATLAB 64bit 2012 r2 2.Windows 64bit OS But when i tried same thing on MATLAB 2008 32 bit on windows 64 bit version it gives following linking error
vecsum.obj : error LNK2019: unresolved external symbol mxDestroyArray referenced in function mexFunction vecsum.obj : error LNK2019: unresolved external symbol mxCreateDoubleScalar referenced in function mexFunction vecsum.obj : error LNK2019: unresolved external symbol mexPrintf referenced in function mexFunction vecsum.obj : error LNK2019: unresolved external symbol mexErrMsgIdAndTxt referenced in function mexFunction vecsum.mexw32 : fatal error LNK1120: 4 unresolved externals
I have set the nvmexopts64.bat LINK path like this
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /MAP /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /implib:%LIB_NAME%.x /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/DEBUG /PDB:"%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb"
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:"%OUTDIR%%MEX_NAME%%MEX_EXT%"
set RSP_FILE_INDICATOR=@
==================
i also put the additional lib path and lib like libmex.lib libmx.lib libmat.lib to the command line like this " nvmex -f nvmexopts64.bat vecsum.cu -IC:\CUDA\include -LC:\CUDA\lib\x64 -lcufft -lcudart –lcuda -LPathto the lib dir of matlab -I path to the include dir of matlab -llibmex -llibmx -llibmat"
But it did not work
回答(1 个)
Kaustubha Govind
2012-7-13
0 个投票
I'm assuming you have two versions of MATLAB on your 64-bit machine - one 32-bit, the other 64-bit. From what I understand, you are able to compile your MEX-files on the 64-bit MATLAB, but not on 32-bit MATLAB? Did you run 'mex -setup" on the 32-bit MATLAB before compiling? You will need to run "mex -setup" every time you switch between the two installations.
4 个评论
sharad saurbh
2012-7-18
Kaustubha Govind
2012-7-18
编辑:Kaustubha Govind
2012-7-18
If you have 64-bit MATLAB installed, you do need to link against all 64-bit libraries and use a 64-bit compiler. Note that Visual Studio itself is always a 32-bit application (and is installed in "Program Files (x86)"), but you need to make sure that the x64 Compilers package is selected at installation.
sharad saurbh
2012-7-20
Kaustubha Govind
2012-7-20
Yes, that is correct.
类别
在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!