From: du on 25 May 2010 07:34 Hello, I write a C-file for S function, and I want to use mex function to produce the .mexw32 file for it. However, when I type: mex getdata.c Matlab shows lots of link errors, like: getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverOpen getdata.obj : error LNK2001: unresolved external symbol _Stat2Str getdata.obj : error LNK2001: unresolved external symbol _WDC_SetDebugOptions getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverClose …… getdata.mexw32 : fatal error LNK1120: 21 unresolved externals D:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Link of 'getdata.mexw32' failed. ??? Error using ==> mex at 206 Unable to complete successfully. I knew the lib file wdapi1000.lib is related to the link problem. But I can’t link the lib. I find in “MEX Script Switches” help file that “-l<name>” switch can link with object library; “-L<directory>” can add <directory> to the list of directories to search for libraries specified with the -l option. So I type: mex -lwdapi1000 -L'E:\Sfun' getdata.c But the link error still exist. And there is a warning: Warning: wdapi1000 specified with -l option not found on -L path I also tried to type: mex -lwdapi1000.lib -L'E:\Sfun' getdata.c mex -L'E:\Sfun' -lwdapi1000.lib getdata.c mex wdapi1000.lib 'E:\Sfun' getdata.c But the link error still exist. I really don’t know how to deal with it. Can someone tell me how to fix the problem?
From: du on 26 May 2010 06:54 "du " <undiedman(a)hotmail.com> wrote in message <htgcjc$jeg$1(a)fred.mathworks.com>... > Hello, > I write a C-file for S function, and I want to use mex function to produce the .mexw32 file for it. However, when I type: > mex getdata.c > Matlab shows lots of link errors, like: > > getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverOpen > getdata.obj : error LNK2001: unresolved external symbol _Stat2Str > getdata.obj : error LNK2001: unresolved external symbol _WDC_SetDebugOptions > getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverClose > …… > getdata.mexw32 : fatal error LNK1120: 21 unresolved externals > > D:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Link of 'getdata.mexw32' failed. > > ??? Error using ==> mex at 206 > Unable to complete successfully. > > I knew the lib file wdapi1000.lib is related to the link problem. But I can’t link the lib. > I find in “MEX Script Switches” help file that “-l<name>” switch can link with object library; “-L<directory>” can add <directory> to the list of directories to search for libraries specified with the -l option. > So I type: > mex -lwdapi1000 -L'E:\Sfun' getdata.c > But the link error still exist. And there is a warning: > Warning: wdapi1000 specified with -l option not found on -L path > I also tried to type: > mex -lwdapi1000.lib -L'E:\Sfun' getdata.c > mex -L'E:\Sfun' -lwdapi1000.lib getdata.c > mex wdapi1000.lib 'E:\Sfun' getdata.c > But the link error still exist. > I really don’t know how to deal with it. Can someone tell me how to fix the problem?
From: James Tursa on 26 May 2010 09:42 "du " <undiedman(a)hotmail.com> wrote in message <htgcjc$jeg$1(a)fred.mathworks.com>... > Hello, > I write a C-file for S function, and I want to use mex function to produce the .mexw32 file for it. However, when I type: > mex getdata.c > Matlab shows lots of link errors, like: > > getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverOpen > getdata.obj : error LNK2001: unresolved external symbol _Stat2Str > getdata.obj : error LNK2001: unresolved external symbol _WDC_SetDebugOptions > getdata.obj : error LNK2001: unresolved external symbol _WDC_DriverClose > …… > getdata.mexw32 : fatal error LNK1120: 21 unresolved externals > > D:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Link of 'getdata.mexw32' failed. > > ??? Error using ==> mex at 206 > Unable to complete successfully. > > I knew the lib file wdapi1000.lib is related to the link problem. But I can’t link the lib. > I find in “MEX Script Switches” help file that “-l<name>” switch can link with object library; “-L<directory>” can add <directory> to the list of directories to search for libraries specified with the -l option. > So I type: > mex -lwdapi1000 -L'E:\Sfun' getdata.c > But the link error still exist. And there is a warning: > Warning: wdapi1000 specified with -l option not found on -L path > I also tried to type: > mex -lwdapi1000.lib -L'E:\Sfun' getdata.c > mex -L'E:\Sfun' -lwdapi1000.lib getdata.c > mex wdapi1000.lib 'E:\Sfun' getdata.c > But the link error still exist. > I really don’t know how to deal with it. Can someone tell me how to fix the problem? Don't use the -l or -L mex options. Instead, create a string variable with the full path name for the file and include that in the mex command. e.g., libname = 'c:\blah blah\libname.lib' mex('getdata.c',libname) James Tursa
|
Pages: 1 Prev: convert p-file to m-files help Next: How to create a message error |