MATLAB: Mex: C2Matlab coding. Problems with libraries while linking (error LNK2019)

linklnk2019MATLABmex

Hi everybody!
This is my first question at MATLAB community. It's about mex. Here I go:
I'm integrating an external procedures for using a digital IO card using mex. The problem is that while I try to compile and link the code I get the error LNK2019.
I call the mex compiler/linker as:
if true
mex -win64 -v -g -lWDT_DIO64.lib pruebaargumentos.cpp % code

end
After that I get:
if true
pruebaargumentos.obj : error LNK2019: unresolved external symbol InitDIO referenced in function mexFunction
pruebaargumentos.mexw64 : fatal error LNK1120: 1 unresolved externals % code
end
The library is at the same path my cpp program is. I've included the header but anyway I get this error.
With the option -c I got the .obj file without a problem so the only thing that remain is linking it to the library (I hope).

Best Answer

Try to use full paths for the file name of the library. If this works, there was a problem with finding the file in the LIBPATH. See -L argument for mex.
Related Question