OpenCV error: "LINK: fatal error LNK1104: cannot open file" opencv_core231d.lib ""

I am trying to compile simple code in visual studio + opencv but got this error.

the code:

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main ( int argc, char **argv )

{
    Mat im_gray;
    Mat img_bw;
    Mat img_final;

    Mat im_rgb  = imread("001.jpg");
    cvtColor(im_rgb,im_gray,CV_RGB2GRAY);

    adaptiveThreshold(im_gray, img_bw, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY_INV, 105, 1); 

    imwrite("001-bw2.jpg", img_final);
    return 0;
}  

Conclusion:

1>------ Build started: Project: pibiti, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'opencv_core231d.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Linker → Input:

opencv_core231d.lib
opencv_highgui231d.lib
opencv_video231d.lib
opencv_ml231d.lib
opencv_legacy231d.lib
opencv_imgproc231d.lib
tbb_debug.lib
tbb_preview_debug.lib
tbbmalloc_debug.lib
tbbmalloc_proxy_debug.lib
tbbproxy_debug.lib

How can i fix this? the file 'opencv_core231d.lib' already exists, why is this error?

+3
source share
5 answers

Add the library file path to the library path.

Right-click the project and go to "Properties-> Linker-> Additional Library". Add a path to this list.

+4
source

. , , "Can not open file". , DLL Linker. , ( "231" ). Dll "249". . : -)

. , opencv_core249d.lib , . , , , , . .

0

, - > Linker- >

$(OPENCV_DIR)\lib

C:\opencv\build\x86\vc12\lib

both in debugging and in release.

And now it works.

0
source

Adding to this list of solutions, I just had to change the project to 64 bit.

0
source

I had a similar problem - I solved it by changing the link in the path. Instead: $(OPENCV_DIR)\libor C:\opencv\build\x86\vc12\libjust add this kind of path \to the end.

For me, this worked with C:\opencv\build\x86\vc12\lib\, so I have not tried the environment variable.

0
source

All Articles