Problem in configuring opencv 2.2 on windows 7 (64-bit):

10,687

Solution 1

Maximus solution sounds like a spray and pray attempt.

I cleanly only added [opencvDir]\include to my visual studio includes and it all worked really fine. Including with your syntax

#include <opencv2/core/core.hpp>

works just fine, thats how i do it. The rest of the steps I did was exactly what you described, except that I have different projects with different parallel opencv installations, so i did not add OpenCV to my global environment variable "PATH" but rather than that I selectively use OpenCV for each project by selection Project Properies (right click project, select properties) => Debugging => "Environment" : Set to PATH=$(SolutionDir)Dependencies\opencv2.2\x86\bin" (in my case), and "merge environment" to "yes"

That is necessary so opencv finds its DLLs in case you link non-static.

Hope that helps :)

Solution 2

You need two include directories. For me it was, C:\OpenCV2.2\include and C:\OpenCV2.2\include\opencv

Share:
10,687

Related videos on Youtube

uyaseen
Author by

uyaseen

Updated on June 04, 2022

Comments

  • uyaseen
    uyaseen almost 2 years

    I have windows 7 (64-bit) and I am trying to configure opencv 2.2 for Microsoft visual studio 2010, I followed the instructions given in the book OpenCV 2 Computer Vision Application Programming Cookbook , but it’s not working, I performed the following steps:

    1. Compile opencv 2.2 using cmake, (source code: C:/OpenCV-2.2.0, where to build binaries: C:/OpenCV-2.2.0/build)
    2. Open OpenCV.sln (which is made as a result of compiling by cmake in the folder C:\OpenCV-2.2.0\build), this is opened in visual studio, I build it (result of build: no errors, few warnings).
    3. Add new property sheet to my project, and in VC++ directories, under the “Include Directories “ I give the path of C:\OpenCV-2.2.0\include\opencv and under the “Library Directories” I give the path of my lib files i.e C:\OpenCV-2.2.0\build\lib\Debug.
    4. Within the linker tab under the Input, included the following Additional dependencies:

      opencv_core220d.lib

      opencv_highgui220d.lib

      opencv_features2d220d.lib

      opencv_calib3d220d.lib

    According to the instructions on the book now everything should be configured correctly, but when I include header files,(after typing (Hash)include (angle bracket)) the intellisense only gives:

    #include <cxcore.h>
    #include <cv.h>
    

    but instead it should had displayed

    #include <opencv2/core/core.hpp>
    

    and when I write

    #include <opencv2/core/core.hpp>
    

    it gives me error cannot open source file “opencv2/core/core.hpp“ , if I include

    #include <cv.h >
    

    I got 11 errors:

    1.  IntelliSense: cannot open source file "opencv2/core/core_c.h"   c:\opencv-    2.2.0\include\opencv\cv.h 63  1   
    
    2.  IntelliSense: cannot open source file "opencv2/core/core.hpp"   c:\opencv-2.2.0\include\opencv\cv.h 64  1   
    
    3.  IntelliSense: cannot open source file "opencv2/imgproc/imgproc_c.h" c:\opencv-2.2.0\include\opencv\cv.h 65  1   
    
    4.  IntelliSense: cannot open source file "opencv2/imgproc/imgproc.hpp" c:\opencv-2.2.0\include\opencv\cv.h 66  1   
    

    [The remaining errors are similar to the above errors.]

    I have not included anything under the C/C++ -> General -> Additional Include Directories in the property sheet, is there any need to include anything there ???

    Can anybody please tell me, what I did wrong in the configuring process?

    Is there any guide available specifically for configuring opencv 2.2 on windows 7 (64-bit) on visual studio 2010?

  • uyaseen
    uyaseen almost 13 years
    dookehster, thanks for reply, i added C:\OpenCV2.2\include in the include directories, now the intellisense is giving #include <opencv2/opencv.hpp>, but when i add this line, visual studio gives me 14 errors, 1 IntelliSense: cannot open source file "opencv2/core/core_c.h" c:\opencv-2.2.0\include\opencv2\open‌​cv.hpp 46 1 2 IntelliSense: cannot open source file "opencv2/core/core.hpp" c:\opencv-2.2.0\include\opencv2\open‌​cv.hpp 47 1 and 12 more similar errors, why is it unable to open the source file??