我正在尝试在Visual Studio + opencv中编译一个简单的代码,但出现此错误。
代码:
#include <cstdio.h>
#include <opencv2\opencv.hpp>
void main(){
std::cout<<CV_VERSION;
}
输出:
error LNK1104: cannot open file 'opencv_core300d.lib'
error MSB6006: "link.exe" exited code1104.
在Configuration Properties
-Linker
-General
-Additional Library Directories
下,您需要添加以下内容:$(OPENCV_DIR)\staticlib;
[OPENCV_DIR
指向您的构建文件夹。例如:E:\opencv\build\x86\vc12
。
完成之后,还需要在Configuration 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
您只需要添加所需的内容,但是添加全部内容没有消极的一面。然后,您确定您不会忘记任何事情。