我是OpenCV的新手,我尝试了一些故障排除,试图让我的标头编译但继续遇到链接器错误。
以下是我要运行的代码:
//Visual Studio
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
//LabView
//#include <NIVision.h>
//Opencv
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
以下是我得到的错误:
1>------ Rebuild All started: Project: Veni_Main, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Veni_Main.cpp
1>c:\opencv\build\include\opencv2\flann\logger.h(66): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(234) : see declaration of 'fopen'
1>LINK : fatal error LNK1104: cannot open file 'opencv_haartraining_engined.lib'
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
我已经为环境变量等添加了正确的路径。请指教!
答案 0 :(得分:7)
我在遵循OpenCV教程时遇到了同样的问题。对我有用的是从链接器的其他依赖项列表中删除“opencv_haartraining_engined.lib”。
要做到这一点:
该文件可能已从最新版本中删除。
答案 1 :(得分:0)
您可能想尝试this link。
如您的错误消息所示,而不是
#define _CRT_SECURE_NO_DEPRECATE
您可能想尝试
#define _CRT_SECURE_NO_WARNINGS
答案 2 :(得分:0)
您可以从https://code.google.com/p/huro-sift/source/browse/trunk/Development/ObjectRecognition/resources/opencv242/lib/debug/opencv_haartraining_engined.lib?r=39下载“opencv_haartraining_engined.lib”
并复制/粘贴到“C:\ Open-CV-2.4.10 \ opencv \ build \ x64 \ vc11 \ lib”