[solved] Mex: Unresolved External when using .lib file

2 views (last 30 days)
Don
Don on 10 Sep 2014
Edited: Don on 11 Sep 2014
Edit: So apparently, the library I was trying to link was compiled in 32 bit, while matlab is a 64 bit version...
Recompiled the library in 64 bit and now it seems to work...
Hi,
So, I'm trying to compile a mex file which uses the Lis library (for linear solvers). When trying to compile it using this command:
mex -v -g -LC:\tmp\lis-1.4.39\lis-1.4.39\lib -llis src\linear\LinearSolvers\lisSolve.cpp
I get the following errors:
|lisSolve.obj : error LNK2019: unresolved external symbol lis_matrix_assemble referenced in function "int __cdecl lisSolve(double *,int *,int *,double *,double *,char *,int,int,int)" (?lisSolve@@YAHPEANPEAH100PEADHHH@Z)|
|lisSolve.obj : error LNK2019: unresolved external symbol lis_matrix_set_coo referenced in function "int __cdecl lisSolve(double *,int *,int *,double *,double *,char *,int,int,int)" (?lisSolve@@YAHPEANPEAH100PEADHHH@Z)|
|lisSolve.obj : error LNK2019: unresolved external symbol lis_matrix_set_size referenced in function "int __cdecl lisSolve(double *,int *,int *,double *,double *,char *,int,int,int)" (?lisSolve@@YAHPEANPEAH100PEADHHH@Z)|
|lisSolve.obj : error LNK2019: unresolved external symbol lis_matrix_create referenced in function "int __cdecl lisSolve(double *,int *,int *,double *,double *,char *,int,int,int)" (?lisSolve@@YAHPEANPEAH100PEADHHH@Z)|
lisSolve.mexw64 : fatal error LNK1120: 4 unresolved externals
These are all four functions that are in the lib file. So somehow it seems that the .lib file is not linked correctly...
When I look at the verbose output, it says: |link /out:"lisSolve.mexw64" /debug /PDB:"lisSolve.mexw64.pdb" /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib
/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 /nologo /manifest /incremental:NO
/implib:"C:\Users\($username)\AppData\Local\Temp\mex_o8yehq\templib.x" /MAP:"lisSolve.mexw64.map" @C:\Users\($username)\AppData\Local\Temp\mex_o8yehq\mex_tmp.rsp C:\tmp\lis-1.4.39\lis-1.4.39\lib\lis.lib |
So at the last line of this wall of text, it shows that the lis.lib file somehow is included in the link command.
Can somebody tell me what I am doing wrong? Because it seems that I fail to properly let the linker know where to find these function definitions...
Thank you in advance!!!
DrDonut
Platform info: OS: Windows 7 Matlab: R2012b Compiler: Visual Studio 2010

Answers (0)

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!