Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

visual c++ - Where are the correct include directories for OpenCV projects using a local build / selfbuild of OpenCV?

I'm trying to debug a frustrating problem whereby I cannot load video files in OpenCV. One suggestion is to abandon the OpenCV pre-built libraries and instead build OpenCV on the same machine as the failing project.

That is what I am now trying to do.

In the OpenCV Quick Start about how to build applications with OpenCV inside the Microsoft Visual Studio one important step is to add the additional include directories to the project property sheet by opening the project's property pages, navigating to Configuration Properties -> C/C++ -> General -> Additional Include Directories. Using the pre-built distribution I am advised to add the directory C:OpenCV2.4.6uildinclude and indeed inside that directory are sub-directories opencv and opencv2. One of the files my project (like most OpenCV projects) will need is highgui.hpp from the line

#include "opencv2/highgui/highgui.hpp"

In the pre-built OpenCV distribution highgui.hpp ends up in C:OpenCV2.4.6uildincludeopencv2highgui and is thus correctly picked up at compile time because of the additional include directory.

Having generated with CMake and built with Visual Studio 2012 the latest version of OpenCV on my machine (though perhaps unsuccessfully) I cannot find highgui.hpp. It is not in C:Users imreganDocumentsGitHubopencvuildinclude (in fact there are no sub-directories opencv nor opencv2 in there). It is in C:opencv-2.4moduleshighguiincludeopencv2highgui.

What step, flag, etc. did I omit in order to generate place it correctly on my machine? Why are the opencv and opencv2 sub-directories missing completely from C:Users imreganDocumentsGitHubopencvuildinclude after I have generated and built OpenCV?

(N.B. I'm using CMake 2.8.12 and Visual Studio 2012 on a Windows 8 machine.)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

open the visual studio solution and right click on install project and then build. the include files should appear in C:Users imreganDocumentsGitHubopencvselfbuildinstall


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...