# 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'


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::gpu::GpuMat dst, src;

cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);

cv::Mat 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

edit retag close merge delete

1

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 !)

( 2017-12-19 07:48:39 -0500 )edit

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.

( 2017-12-19 09:45:35 -0500 )edit

Aaand this time: fatal error C1083: Cannot open include file: 'opencv2/opencv_modules.hpp': No such file or directory

( 2017-12-20 09:04:51 -0500 )edit

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)

( 2017-12-20 09:13:07 -0500 )edit
1

I updated the question for you @berak.

( 2017-12-20 09:21:44 -0500 )edit
1

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 !)

( 2017-12-20 09:40:14 -0500 )edit

Perhaps you may wish to change the title of your post, to reflect the new error? :)

( 2017-12-20 09:40:53 -0500 )edit
2

@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.

( 2017-12-20 09:48:35 -0500 )edit
1

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 ...)

( 2017-12-20 09:56:02 -0500 )edit

Sort by » oldest newest most voted

The following steps were taken to solve the problem:

You need to download the Github source code of OpenCV from the official website if you want to use VS2013, since I had to build everything from the source. I used CMake to configure and generate the files. As for BUILD and INSTALL, VS2013 itself was used.

After that I took the steps which I showed above in the screenshots, but what I was missing, and was pointed out by @berak , was that I had to also add:

c:/opencv/build/install/include


After that I still got an error, but this time it was complaining about the gpu.hpp, with a quick search I found out that the code in the tutorial was not supposed to be used, instead the code below was supposed to be used (just to test) and ta da, after replacing the code I got everything running.

more

Official site

GitHub

Wiki

Documentation