Reputation: 1201
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:
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?
Upvotes: 4
Views: 10720
Reputation: 22518
In my property page,
in C/C++ -> Addictional Include Directory
I was using "%OPENCV_DIR\build\include"
Replacing by the real path fixed the issue with intellisense:
"C:\opencv\build\include"
I am running opencv 2.4.2 and Visual Studio 2010 SP1.
Upvotes: 0
Reputation: 3183
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 :)
Upvotes: 2
Reputation: 4302
Try including all directories in C:\opencv-2.2.0\modules\module_name\include For example in your case it could be C:\opencv-2.2.0\modules\core\include\ C:\opencv-2.2.0\modules\imgproc\include\ and many more. You should use comand line to get that list of directories in the C:\opencv-2.2.0\modules. And after each add include. I don't know why does this happens..
Upvotes: 0
Reputation: 1656
You need two include directories. For me it was, C:\OpenCV2.2\include and C:\OpenCV2.2\include\opencv
Upvotes: 1