Unable to compile/link program after inclusion of opencv.hpp
I am trying to compile a program which uses opencv. I have included the opencv.hpp file in the .h and the .c file which needs the opencv functions. The project also has the properties set to use opencv. I am using 2.4.5 version of opencv. The problems I am facing is that after including these files in the project the project fails to compile. I get an error saying I have failed to #inlcude "stdafx.h". This is because I am using precompiled headers and #include"stdafx.h" has to be the first line of code in that .c or .cpp file. If I add the inclusion of stdafx.h tehn the program compiles but it does not link.
shown below is how i have included the files in the .c file.
#include "../stdafx.h"
#include "C:\opencv\include\opencv2\opencv.hpp"
#include "DPD_AlgorithmInit.h"
and shown below is the inclusion in the .h file
#include "C:\opencv\build\include\opencv2\core\types_c.h"
the error I am receiving is
error C1083: Cannot open source file: '..\MOSS\PedestrianDetection\DPD_Tracker.c': No such file or directory C:\Users\sankalp\Desktop\check\MOSS_Evaluation\c1
error LNK2001: unresolved external symbol _InitializeTracker C:\Users\sankalp\Desktop\check\MOSS\DPD_AlgorithmInit.obj
error LNK2001: unresolved external symbol _DPD_Tracker C:\Users\sankalp\Desktop\check\MOSS\DPD_AlgorithmInit.obj
error LNK2001: unresolved external symbol "unsigned char * __cdecl DPD_Alloc(unsigned int)" (?DPD_Alloc@@YAPAEI@Z) C:\Users\sankalp\Desktop\check\MOSS\DPD_Tracker1.obj
error LNK1120: 3 unresolved externals C:\Users\sankalp\Desktop\check\Release\MOSS.exe
Am I doing something wrong while including the .hpp file? Is there a better way to include opencv to alllow compilation and linking?
those are all linker errors, unrelated to c++ headers.
most likely, you forgot to add some cpp file to your project, try to find e.g. the implementation of
InitializeTracker
then, just saying, opencv's c-api should no more be used, if you find a lot of IplImage* in that code, consider using something else instead.
Or you can start by translating it to the new C++ interface and commit it to the repository through a PR :D