2013-03-03 388 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。

相關問題