2013-03-03 395 views
0

我试图通过在我的代码块中使用Kinect和openCV库来运行C++程序。一切似乎罚款期待我总是得到一个错误说:cv.h没有这样的文件或目录,但有这样的文件

/home/maoyi/Documents/practice/practice2.cpp:10:16: fatal error: cv.h: No such file or directory compilation terminated.

谁能告诉我,究竟是什么说没有这样的文件或目录有什么意思?因为我非常肯定我有一个practice2.cpp文件,我安装了46%的OpenCV库。我按照如何安装OpenCV2.1.0教程的说明:

http://www.samontab.com/web/2010/04/installing-opencv-2-1-in-ubuntu/

我在“CMAKE”遇到问题。步骤,并得到一些提示是这样的:

-- Detected version of GNU GCC: 46 (406) -- checking for module 'gstreamer-base-0.10' -- package 'gstreamer-base-0.10' not found -- checking for module 'gstreamer-app-0.10' -- package 'gstreamer-app-0.10' not found -- checking for module 'gstreamer-video-0.10' -- package 'gstreamer-video-0.10' not found -- checking for module 'libdc1394-2' -- package 'libdc1394-2' not found -- checking for module 'libdc1394' -- package 'libdc1394' not found -- checking for module 'libv4l1' -- package 'libv4l1' not found -- Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) Traceback (most recent call last): File "", line 1, in ImportError: No module named numpy.distutils -- IPP detected: -- Parsing 'cvconfig.h.cmake'

而且我还试图打开我的立得软件包管理手动安装所有缺少的模块,但是我甚至找不到其中的一些。 (例如gstream-app-0.10)...所以我不知道这是否会导致“没有这样的文件或diretory”错误或什么。我对OpenCV很新,所以不要惊讶,如果问题很愚蠢。 但无论如何,我继续下一步“制造”的步骤,并得到更多的绝望的提示下面。安装停止在46%,我提到了大量的错误... 所以我希望有人可以看看它,也许可以暗示我一些解决方案。非常感谢!

[ 45%] Built target opencv_lapack [ 45%] Building CXX object src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o In file included from /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.h:1826:0, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/_cxcore.h:51, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/cxcore_pch_dephelp.cxx:1: /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.hpp:177:13: error: ‘ptrdiff_t’ does not name a type In file included from /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.hpp:2307:0, from /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.h:1826, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/_cxcore.h:51, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/cxcore_pch_dephelp.cxx:1: /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxoperations.hpp:2043:15: error: ‘ptrdiff_t’ does not name a type /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxoperations.hpp:2591:31: error: ‘ptrdiff_t’ does not name a type In file included from /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.hpp:2308:0, from /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxcore.h:1826, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/_cxcore.h:51, from /home/maoyihuang/Downloads/OpenCV-2.1.0/src/cxcore/cxcore_pch_dephelp.cxx:1: /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp: In member function ‘void cv::Mat::locateROI(cv::Size&, cv::Point&) const’: /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:5: error: ‘ptrdiff_t’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:5: note: suggested alternatives: /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:387:15: error: expected ‘;’ before ‘delta1’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:389:9: error: ‘delta1’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:398:31: error: ‘delta2’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp: In member function ‘cv::Point cv::MatConstIterator_<_Tp>::pos() const’: /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:9: error: ‘ptrdiff_t’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:9: note: suggested alternatives: /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3459:19: error: expected ‘;’ before ‘ofs’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3460:23: error: ‘ofs’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3460:66: error: expected ‘)’ before ‘y’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:9: error: ‘ptrdiff_t’ was not declared in this scope /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:9: note: suggested alternatives: /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /usr/include/c++/4.6/i686-linux-gnu/./bits/c++config.h:156:28: note: ‘std::ptrdiff_t’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3465:19: error: expected ‘;’ before ‘ofs’ /home/maoyihuang/Downloads/OpenCV-2.1.0/include/opencv/cxmat.hpp:3466:23: error: ‘ofs’ was not declared in this scope make[2]: * [src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o] Error 1 make[1]: * [src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/all] Error 2 make: * [all] Error 2

回答

0

要做的第一件事就是使用ccmake(package cmake-curses-gui)。它使cmake的使用更容易。其次,只要cmake报告错误,您甚至不应该尝试编译。尝试使用包管理器来安装缺少的库。仅使用库名称进行搜索,因为版本可能有所不同。大多数库在opencv网页上列出,以便从linux上的源代码安装。也有简单的方法。使用软件包管理器从存储库安装opencv。

相关问题