OpenCV error: "LINK: fatal error LNK1104: unable to open file" opencv_core300d.lib ""

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

code:

#include <cstdio.h>
#include <opencv2\opencv.hpp>

void main(){  
   std::cout<<CV_VERSION;
}

      

Output:

error LNK1104: cannot open file 'opencv_core300d.lib'
error MSB6006: "link.exe" exited code1104.

      

+3


source to share


1 answer


You probably added the correct include directories, but you forgot to link the actual libraries.

In the section Common Properties

- Linker

- General

- Additional Library Directories

you need to add the following: $(OPENCV_DIR)\staticlib;

C OPENCV_DIR

pointing to your build folder. For example: E:\opencv\build\x86\vc12

.



After you have done that, you also need to add below lines in Common Properties

- Linker

- Input

-Additional Dependencies

IlmImfd.lib
libjasperd.lib
libpngd.lib
libjpegd.lib
libtiffd.lib
libwebpd.lib
opencv_calib3d300d.lib
opencv_core300d.lib
opencv_features2d300d.lib
opencv_flann300d.lib
opencv_hal300d.lib
opencv_highgui300d.lib
opencv_imgcodecs300d.lib
opencv_imgproc300d.lib
opencv_ml300d.lib
opencv_objdetect300d.lib
opencv_photo300d.lib
opencv_shape300d.lib
opencv_stitching300d.lib
opencv_superres300d.lib
opencv_ts300d.lib
opencv_video300d.lib
opencv_videoio300d.lib
opencv_videostab300d.lib
zlibd.lib
ippicvmt.lib
comctl32.lib
vfw32.lib

      

You only need to add the ones you need, but there is no downside to adding them. Then you are sure you haven't forgotten anything.

+3


source







All Articles