I am using OpenCV 2.4.5 with a Visual C++ project in the Visual Studio 2012 IDE. My project works correctly in DEBUG mode, but in RELEASE mode, I get the following compile error:
error LNK1181: cannot open input file 'opencv_core245.lib'
I then installed OpenCV and set up the environment variables as follows:
- Created the following System Variable: OPENCV_BUILD with the path C:\opencv\build\
- Added the following to the Path variable: C:\opencv\build\x86\vc11\bin
Then, in Visual Studio 2012, I created a new property sheet for the debug mode as follows:
Clicked View >> Property Manager Right clicked Debug >> Add New Project Property Sheet
I then edited the property sheet as follows:
C/C++ >> General >> Additional Include Directories: $(OPENCV_BUILD)\include;%(AdditionalIncludeDirectories)
Linker >> General >> Additional Library Directories: $(OPENCV_BUILD)\x86\vc11\lib;%(AdditionalLibraryDirectories)
Linker >> Input >> Additional Dependencies: opencv_core245d.lib;opencv_imgproc245d.lib;opencv_highgui245d.lib;opencv_ml245d.lib;opencv_video245d.lib;opencv_features2d245d.lib;opencv_calib3d245d.lib;opencv_objdetect245d.lib;opencv_contrib245d.lib;opencv_legacy245d.lib;opencv_flann245d.lib;%(AdditionalDependencies)
I followed the same procedure to create a new property sheet for the release mode (I also followed the same procedure for editing the project properties), but for Linker >> Input >> Additional Dependencies I omitted the "d" from each .lib filename (for example opencv_core245.lib instead of opencv_core245d.lib).
In my code, I usually include the files as follows:
#include <opencv2\highgui\highgui.hpp>
As I mention earlier, everything works fine in DEBUG mode, but in RELEASE mode I get the following compile error:
error LNK1181: cannot open input file 'opencv_core245.lib'
I've read so many other posts on this forum, but nothing seems to work. Can someone please help me, I am really desperate.