fatal error LNK1181: cannot open input file 'opencv_world311.lib'
Hi,
I have followed this tutorial regarding installing OpenCV 3.0.0 with VS13 and I am trying to make my OpenCV 3.3.1 work but no luck, looked for 2 hours for a remedy, followed tons of tutorials but I keep getting the same error. I am using VS13 and Windows 10 64 bit.
fatal error LNK1181: cannot open input file 'opencv_world311.lib'
Before you ask: yes, I have added
C:\opencv\build\x64\vc14\bin
to my PATH. If that is the only thing to do there, this should be fine. (Haven't added anything to user variables, FYI)
UPDATE!
So I built everything from the source which I got from official Github page of OpenCV. I used CMAKE and VS to build and install. No error here at all.
I added the following to my environment variable and PATH, respectively:
C:\opencv\build\install\x64\vc12
%OPENCV_DIR%/bin
Then, I set the following as it was in every tutorial:
And finally, this is the piece of code I am trying to build (yes, I need GPU support):
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
int main(int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread("hdd.png", CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);
cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);
cv::Mat result_host;
dst.download(result_host);
cv::imshow("Result", result_host);
cv::waitKey();
}
catch (const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
And this time getting:
fatal error C1083: Cannot open include file: 'opencv2/opencv_modules.hpp': No such file or directory
libs are in C:\opencv\build\x64\vc14\lib, and you have to add this to your ADDITONAL_LIBRARY_PATH in your linker settings (IDE), not to your PATH environment var, which is for the dlls.
then, the prebuilt libs are for VS2015 ONLY. if you want to use VS2013, you'll have to build the opencv libs from src, using cmake.
can you just update your VS ? (much easier for an obvious noob !)
I am bound to use VS13 due to a restriction. But okay, I'll have to then build opencv from src using cmake on Windows and retry again, and we shall see. Thanks.
Aaand this time:
fatal error C1083: Cannot open include file: 'opencv2/opencv_modules.hpp': No such file or directory
does that happen, while compiling the libs ? (in other words, did you succeed building them ?)
if so, did you build the INSTALL project ? after that, all you need is in build/install. (and you need to rewire your original project to this, so it's using the newly built libs)
I updated the question for you @berak.
first, congrats, that you succeed building the libs !
it seems, you also have to adjust your "Additional Include Directories" to
c:/opencv/build/install/include
(opencv2/opencv_modules.hpp should be in that folder, too !)
Perhaps you may wish to change the title of your post, to reflect the new error? :)
@berak Yes, that was the answer, it solved the problem. Also, the code which I took from the tutorial was not appropriate, instead this had to be used. So, if you post it as an answer, I can accept it.
i have another proposal ;)
maybe you could write up a short description of the steps you had to take ?
that would be the much better answer !! (especially, because the official tutorial is so outdated ...)