brrngsk
brrngsk

Reputation: 1

LINK : fatal error LNK1181: cannot open input file 'cv.lib'

i have been stuck with this problem since yesterday, and i cant figure it out. im already following the steps from this pdf http://www.mathworks.in/matlabcentral/fileexchange/21818-opencv-and-mex-files-quick-guide

and this is my mexopts.bat looks like :

@echo off
rem MSVC100OPTS.BAT
rem
rem Compile and link options used for building MEX-files
rem using the Microsoft Visual C++ compiler version 10.0
rem
rem $Revision: 1.1.6.4.2.1 $ $Date: 2012/07/12 13:53:59 $
rem Copyright 2007-2009 The MathWorks, Inc.
rem
rem StorageVersion: 1.0
rem C++keyFileName: MSVC100OPTS.BAT
rem C++keyName: Microsoft Visual C++ 2010
rem C++keyManufacturer: Microsoft
rem C++keyVersion: 10.0
rem C++keyLanguage: C++
rem C++keyLinkerName: Microsoft Visual C++ 2010
rem C++keyLinkerVersion: 10.0
rem
rem ****************************************************************
rem General parameters
rem ****************************************************************
set MATLAB=%MATLAB%
set OPENCVDIR=D:\OPENCV\opencv\build
set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC
rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\
set PATH=%VCINSTALLDIR%\bin\amd64;%VCINSTALLDIR%\bin;%VCINSTALLDIR%\VCPackages;%VSINSTALLDIR%\Common7\IDE;%VSINSTALLDIR%\Common7\Tools;%LINKERDIR%\bin\x64;%LINKERDIR%\bin;%MATLAB_BIN%;%PATH%
set INCLUDE=%OPENCVDIR%\include;%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\ATLMFC\INCLUDE;%LINKERDIR%\include;%INCLUDE%
set
LIB=%OPENCVDIR%\x64\vc10\lib;%OPENCVDIR%\x64\vc10\bin;%VCINSTALLDIR%\LIB\amd64;%VCINSTALLDIR%\ATLMFC\LIB\amd64;%LINKERDIR%\lib\x64;%MATLAB%\extern\lib\win64;%LIB%
set MW_TARGET_ARCH=win64
rem ****************************************************************
rem Compiler parameters
rem ****************************************************************
set COMPILER=cl
set COMPFLAGS=/c /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
set OPTIMFLAGS=/O2 /Oy- /DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo
rem ****************************************************************
rem Linker parameters
rem ****************************************************************
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%OPENCVDIR%" cv.lib highgui.lib cvaux.lib cxcore.lib /LIBPATH:"%LIBLOC%" 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:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map"
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=@
rem ****************************************************************
rem Resource compiler parameters
rem ****************************************************************
set RC_COMPILER=rc /fo "%OUTDIR%mexversion.res"
set RC_LINKER=
set POSTLINK_CMDS=del "%LIB_NAME%.x" "%LIB_NAME%.exp"
set POSTLINK_CMDS1=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%;2" -manifest "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS2=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest"
set POSTLINK_CMDS3=del "%OUTDIR%%MEX_NAME%%MEX_EXT%.map"

but i got an error like this :

LINK : fatal error LNK1181: cannot open input file 'cv.lib'

C:\PROGRA~1\MATLAB\R2012B\BIN\MEX.PL:
Error: Link of 'displayimage.mexw64' failed.

Please help me to solve this, and thanks in advance. by the way im using Matlab R2012b and OpenCV 2.4.9

Upvotes: 0

Views: 3235

Answers (2)

berak
berak

Reputation: 39816

those missing 3 opencv libs were used with like opencv 1.0. long time ago. but no more.

set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%OPENCVDIR%" cv.lib highgui.lib cvaux.lib cxcore.lib 

the current names of the opencv_libs are like opencv_core248.lib, opencv_highgui248.lib, etc. look inside that %OPENCVDIR%\x64\vc10\lib folder and instead add what you find there.

Upvotes: 0

thurizas
thurizas

Reputation: 2528

according to this site http://msdn.microsoft.com/en-us/library/y6b12xkc%28v=vs.100%29.aspx., the particular error code results when the file can not be found.

Also, I think that I gotten this error message when I accidentally mixed 32-bit and 64-bit libraries, but that is just a vague recollection.

Upvotes: 0

Related Questions