1

I am using Visual Studio 2013. I'm trying to build some code given to me from my professor and I keep getting this error:

LINK : fatal error LNK1181: cannot open input file 'C:\Users\manduchi\Documents\eyegaze\EyeGazeDemo..\Libraries\OpenCV\lib\opencv_core249.lib'

However, on my computer opencv_core249.lib is located somewhere else. I've tried updating the linker directories to the address on my computer, but I continue getting the error.

Here was my attempt:

  • Under Configuration Properties-> VC++ Directories, I added the address of the folder enclosing the .lib file in Include Directories and in Library Directories.
  • Linker-> General and added an additional library directory there as well.
  • Linker-> Input and added "opencv_core249.lib" to additional dependencies

I'm new to Visual Studio and C++, so I might have done it incorrectly?

More info:

  • I'm doing this on my Windows 7 Bootcamp
  • the code is on a USB stick because I don't have enough space on my bootcamp partition.

Any help would be appreciated! Thanks

Update

Updated Error Message

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

I think 'opencv_calib3d300.lib' is on the Linker->input->Additional Dependencies under inherited values.

Linker Command Line

/OUT:"debug\EyeGazeDemo.exe" /MANIFEST /NXCOMPAT /PDB:"debug\EyeGazeDemo.pdb" /DYNAMICBASE "glu32.lib" "opengl32.lib" "gdi32.lib" "user32.lib" "opencv_ts300.lib" "opencv_ts300d.lib" "opencv_world300.lib" "opencv_world300d.lib" "E:\Qt\5.0.2\msvc2012_64\lib\qtmaind.lib" "E:\Qt\5.0.2\msvc2012_64\lib\Qt5Cored.lib" "E:\Qt\5.0.2\msvc2012_64\lib\Qt5Widgetsd.lib" "E:\Qt\5.0.2\msvc2012_64\lib\Qt5Guid.lib" "opencv_calib3d300.lib" "opencv_contrib300.lib" "opencv_core300.lib" "opencv_features2d300.lib" "opencv_flann300.lib" "opencv_gpu300.lib" "opencv_highgui300.lib" "opencv_imgproc300.lib" "opencv_legacy300.lib" "opencv_ml300d.lib" "opencv_nonfree300d.lib" "opencv_objdetect300d.lib" "opencv_ocl300d.lib" "opencv_photo300d.lib" "opencv_stitching300d.lib" "opencv_superres300d.lib" "opencv_video300d.lib" "opencv_videostab300d.lib" "kernel32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" "OpenCVConfig.cmake" "OpenCVModules.cmake" "OpenCVModules-debug.cmake" "OpenCVModules-release.cmake" "E:\eyegaze\eyegaze\Libraries\OpenCV\lib\opencv_core249d.lib" "E:\eyegaze\eyegaze\Libraries\OpenCV\lib\opencv_imgproc249d.lib" "E:\eyegaze\eyegaze\Libraries\OpenCV\lib\opencv_highgui249d.lib" "E:\eyegaze\eyegaze\Libraries\OpenCV\lib\opencv_objdetect249d.lib" "E:\eyegaze\eyegaze\Libraries\OpenCV\lib\opencv_ml249d.lib" "E:\eyegaze\eyegaze\Libraries\Intraface\lib\IntraFaceDLL-x86d.lib" /DEBUG /MACHINE:X86 /SAFESEH /INCREMENTAL:NO /PGD:"debug\EyeGazeDemo.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Win32\Debug\EyeGazeDemo.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\opencv\build\x64\vc12\x64\vc11\lib" /LIBPATH:"E:\Qt\5.0.2\msvc2012_64\lib" /LIBPATH:"E:\eyegaze\eyegaze\Libraries\OpenCV\lib" /LIBPATH:"E:\eyegaze\eyegaze\Libraries\Intraface\lib" /LIBPATH:"E:\eyegaze\eyegaze\EyeGazeDemo" /LIBPATH:"C:\opencv\build\x64\vc12\lib" /TLBID:1

Joissa.R
  • 111
  • 1
  • 3
  • 8
  • Please describe in detail the steps you took to change the linker settings. – PaulMcKenzie Jun 15 '15 at 16:31
  • I right clicked on the project that was giving me the error. I then clicked on properties. Under Configuration Properties-> VC++ Directories, I added some directories in Include Directories and in Library Directories. I also went to Linker-> General and added an additional library directory there as well. And lastly I went to Linker-> Input and added "opencv_core249.lib" to additional dependencies. – Joissa.R Jun 15 '15 at 16:43
  • looks like that wrong path is set somewhere directly in your "linker input" setting. maybe within a variable. can you post your whole "linker command line"? – Micka Jun 16 '15 at 08:16
  • @Micka I've included the linker command line in my post, thanks! – Joissa.R Jun 16 '15 at 17:24
  • your project seems to want opencv_core249.lib, while you got opencv_core300.lib just change the version number ? – berak Jun 16 '15 at 17:26
  • @Micka Can I still do that if I dont have OpenCV 2.49 installed? I currently have 3.0 . – Joissa.R Jun 16 '15 at 17:47
  • just try to remove all the opencv249 linker entries – Micka Jun 16 '15 at 18:10
  • and add the opencv300 lib path to lib pathes – Micka Jun 16 '15 at 18:12

2 Answers2

3

Remove all references to the library. Somewhere that project is pointing at the path you give above and you need to remove that.

Then add the library into the executable project. Right click->add->existing item, change the type to all files, then browse to the file location.

mike
  • 1,192
  • 9
  • 32
  • I'm sorry but how would I go about removing all references to the library? Would I have to look somewhere in the code or in the properties? – Joissa.R Jun 15 '15 at 16:53
  • Under linker->input->additional dependencies, remove opencv_core249.lib. I suggest this because it will try to find it using the combination of library paths that are in the project, which can be difficult to check. If you then add it using the method above, you'll know you're asking visual studio to look in the right place. You should be able to double click the icon for opencv_core249.lib underneath the project, and see a binary file. If not, then there's an issue actually accessing the file. – mike Jun 16 '15 at 08:15
  • @Mike: Thank you!...It was referencing a name that doesn't exist. I changed the name and it now works! – Pangu May 10 '16 at 23:17
1

You will need to know the location of the .lib file and then you will need to add it into your project configurations. It will be very similar to if you were adding a DirectX library reference, BOOST, etc. I found the following post which shows how to add additional libraries

You will also want to make sure you apply the changes to ALL builds so that you are covered for release, debug, etc.

Community
  • 1
  • 1
MattTanner
  • 296
  • 1
  • 4
  • 12