0

I'm new to OpenCV and I've tried some troubleshooting with trying to get my headers to compile but keep running into Linker Errors.

Here is the code I want to run:

//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"

And Here is the Errors I'm getting:

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 ==========

I've already added the correct paths for the environmental variables and such. Please advise!

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
thunderknight
  • 3
  • 1
  • 1
  • 2

3 Answers3

7

I had the same issue while following an OpenCV tutorial. What worked for me was removing 'opencv_haartraining_engined.lib' from the list of additional dependencies for the linker.

To do this:

  1. right click the project
  2. properties
  3. Switch Configuration to 'All Configurations'
  4. Expand configuration properties
  5. Expand Linker
  6. Select Input
  7. Click the drop-down for 'Additional Dependencies' then click 'Edit'
  8. Remove the 'opencv_haartraining_engined.lib' line.

It's possible that file was removed from more recent releases.

jvhang
  • 747
  • 6
  • 19
  • Also when I check the folder under the opencv_haartraining_engined.lib file does not appear to be there. However the application file for it exists under – thunderknight Jan 02 '14 at 20:11
  • I'm not an expert on this but double-check that all references to that .lib file are removed from your project. One way to look quickly is to open the project file in notepad, or similar, and search for that file. I suspect there's still a stray reference to it and you likely don't need it. Alternately, find a copy of that .lib file. – jvhang Jan 03 '14 at 14:20
  • I added the libraries from an older version of OpenCV. Just make sure you have all of the right .lib files in the folders, even if you have to download them from elsewhere. Thanks everyone! – thunderknight Jan 21 '14 at 16:27
0

You might want to try this link.

As written in your error message, instead of

#define _CRT_SECURE_NO_DEPRECATE

you might want to try

#define _CRT_SECURE_NO_WARNINGS
Community
  • 1
  • 1
JonasVautherin
  • 7,297
  • 6
  • 49
  • 95
  • Still doesn't seem to work...I think the main problem is the link error...any idea how to fix the 'opencv_haartraining_engined.lib' issue??? – thunderknight Jan 01 '14 at 00:41
0

You can download the "opencv_haartraining_engined.lib" from https://code.google.com/p/huro-sift/source/browse/trunk/Development/ObjectRecognition/resources/opencv242/lib/debug/opencv_haartraining_engined.lib?r=39

and do copy/paste to "C:\Open-CV-2.4.10\opencv\build\x64\vc11\lib"

oya163
  • 1,371
  • 2
  • 16
  • 20