C++ 如何解决imgproc.hpp 和core.hpp 出错?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11072554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve an error with imgproc.hpp and core.hpp?
提问by Thar1988
i used a c++ programm for image processing using opencv 2.1. and that program has below include files:
我使用 c++ 程序使用 opencv 2.1 进行图像处理。该程序具有以下包含文件:
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <math.h>
#include <string.h>
but after debuging the program i get error message as:
但在调试程序后,我收到错误消息:
fatal error C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory.
致命错误 C1083:无法打开包含文件:'opencv2/core/core.hpp':没有这样的文件或目录。
that is same as for imgproc.hppand highgui.hppafter that i changed #include "opencv2/highgui/highgui.hpp"
to #include <highgui.h>
and that error solved.
这是相同imgproc.hpp和highgui.hpp后,我改变了 #include "opencv2/highgui/highgui.hpp"
对#include <highgui.h>
和错误解决。
But i could not find a solution for imgproc.hppand highgui.hppand there are no files named imgproc.hppand highgui.hppinside the opencv folder.
但是我找不到imgproc.hpp和highgui.hpp的解决方案,并且opencv 文件夹中没有名为imgproc.hpp和highgui.hpp的文件。
How can i solve this error?
我该如何解决这个错误?
回答by kebs
From the path separator, I assume you are using *nix OS. So the following shell commands should help you to find the correct location of the header files:
从路径分隔符来看,我假设您使用的是 *nix OS。因此,以下 shell 命令应该可以帮助您找到头文件的正确位置:
locate highgui.h
locate highgui.hpp
回答by Alex Williams
As previously stated, your libraries aren't in an included area. Most people have tailored their responses to a Linux-based system, but if you're on Windows (i.e. Using Visual Studio), you can usually just include the entire path of your library folder in the include statement.
如前所述,您的库不在包含区域内。大多数人都针对基于 Linux 的系统定制了他们的响应,但是如果您使用的是 Windows(即使用 Visual Studio),您通常可以在 include 语句中包含库文件夹的整个路径。
For example:
例如:
#include "C:\OpenCV\bin\install\opencv2\highgui\highgui.hpp"
#include "C:\OpenCV\bin\install\opencv2\imgproc\imgproc.hpp"
I recently had my fair share of errors after trying to install OpenCV 2.4.1 and finding the correct directories to include (both for 'include' and 'lib') was difficult at first. I recommend re-installing your OpenCV and going from there.
我最近在尝试安装 OpenCV 2.4.1 后遇到了相当多的错误,并且一开始很难找到要包含的正确目录(包括“include”和“lib”)。我建议重新安装您的 OpenCV 并从那里开始。