抑制状态错误 LNK1104 无法打开文件 'IlmImfd.lib'

Suppression State Error LNK1104 cannot open file 'IlmImfd.lib'

我的链接部分似乎有错误,尽管我的代码编译没有错误。

我这样设置 属性:

我还在 Linker -> General -> Additional library directoriesLinker -> Input -> Additional Dependencies

之后还是报错

代码:

#include "opencv2/core.hpp"
#include "C:/Users/Downloads/opencv_contrib-master/opencv_contrib-master/modules/face/include/opencv2/face.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/objdetect.hpp"

#include <iostream>
#include <fstream>
#include <sstream>

using namespace cv;
using namespace cv::face;
using namespace std;

(输出)错误行:

Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'IlmImfd.lib'    opencvTry

(输出)当我尝试使用包含 lib 文件的相同代码重做项目时:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: static struct 
cv::Ptr<class cv::face::FisherFaceRecognizer> __cdecl 
cv::face::FisherFaceRecognizer::create(int,double)" ( 
create@FisherFaceRecognizer@face@cv@@SA?AU?
$Ptr@VFisherFaceRecognizer@face@cv@@@3@HN@Z) referenced in function main    
opencvTry   C:\Users1554F\Documents\Visual Studio 2017\Projects\In 
progress\Face recog\opencvTry\try.obj   1

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: int __cdecl 
cv::face::FaceRecognizer::predict(class cv::_InputArray const &)const " (?
predict@FaceRecognizer@face@cv@@QEBAHAEBV_InputArray@3@@Z) referenced in 
function main   opencvTry   C:\Users1554F\Documents\Visual Studio 
2017\Projects\In progress\Face recog\opencvTry\try.obj  1   

您可能添加了正确的包含目录,但您忘记了 link 实际的库。

Configuration Properties - Linker - General - Additional Library Directories 下你需要添加以下内容: $(OPENCV_DIR)\staticlib;

OPENCV_DIR 指向您的构建文件夹。 例如:E:\opencv\build\x86\vc12.

完成后,您还需要在 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

您只需要添加您需要的那些,但将它们全部添加也没有负面影响。那么,你确定你没有忘记任何东西。