MATLAB: Mex – Compiler doesn’t include *.lib but they are there!

include librariesmex compiler

Hi,
I am using Matlab 2013a 64 Bit with the supported compiler from the Microsoft SDK 7.1, so far so good. I want to include some "*.lib" into my mex file that are needed, first idea was to include the whole directory with -L for the libs and -I for the headers needed. This worked well with some other mex files but with this file it fails. So I tried to include the libs directly using -l and this error message comes to the command window:
Warning: MEX could not find the library "D:\Sapera\Lib\Win64\SapClassBasic" specified with -l option.
MEX looked for a file with one of the names:
D:\Sapera\Lib\Win64\SapClassBasic.lib
libD:\Sapera\Lib\Win64\SapClassBasic.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files\Microsoft SDKs\Windows\v7.1\LIB\X64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\AMD64
C:\Program Files\MATLAB\R2013a\extern\lib\win64
C:\Program Files\MATLAB\R2013a\extern\lib\win64\microsoft
D:\Sapera\Lib\Win64\
D:\Sapera\Lib\Win64\VS2010
C:\WinDDK\7600.16385.1\lib\Mfc
C:\WinDDK\7600.16385.1\lib\win7\amd64
The lib is there but the compiler doesn't find it and i so far don't know how to fix it, do you have an idea?

Best Answer

Hi,
it seems like you specified the full name to the lib file. That is not needed. with -L flag you specifiy the folders to look in and with -l you specify the filename only, e.g.
mex yourcode.c -LD:\Sapera\Lib\Win64\ -lSapClassBasic