2011-09-14 8 views
2

OpenCV 웹 사이트에서 OpenCV 2.3.1을 다운로드하고 /usr/share/src에 압축을 풉니 다. 나는 메이크업 파일을 생성하기 위해 해당 폴더에 sudo cmake .를 실행 한 다음 "sudo make"나는 다음과 같은 오류지고있어 실행 : 왜이 ​​OpenCV를 만들 수 없습니다

[ 20%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/loadsave.o

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:298: error: ‘InputArray’ has not been declared

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘bool cv::imwrite(const std::string&, int, const std::vector >&)’:

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:301: error: request for member ‘getMat’ in ‘_img’, which is of non-class type ‘int’

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘void* cv::imdecode_(const cv::Mat&, int, int, cv::Mat*)’:

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:312: error: ‘tempfile’ was not declared in this scope

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: At global scope:

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: ‘cv::Mat cv::imdecode’ redeclared as different kind of symbol

/opt/local/include/opencv2/highgui/highgui.hpp:107: error: previous declaration of ‘cv::Mat cv::imdecode(const cv::Mat&, int)’

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: ‘InputArray’ was not declared in this scope

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: expected primary-expression before ‘int’

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:399: error: ‘InputArray’ has not been declared

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘bool cv::imencode(const std::string&, int, std::vector >&, const std::vector >&)’:

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:402: error: request for member ‘getMat’ in ‘_image’, which is of non-class type ‘int’

/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:427: error: ‘tempfile’ was not declared in this scope

make[2]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/src/loadsave.o] Error 1

make[1]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error

입니다? 어떻게 해결할 수 있습니까? 감사합니다

전체 오류는 다음과 같다 :

make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.o] Error 1 
make[2]: *** Waiting for unfinished jobs.... 
In file included from /usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::grabFrame()’: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:638: warning: ‘avcodec_decode_video’ is deprecated (declared at /opt/local/include/libavcodec/avcodec.h:3454) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:640: warning: ‘avcodec_decode_video’ is deprecated (declared at /opt/local/include/libavcodec/avcodec.h:3454) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1339: warning: ‘guess_format’ is deprecated (declared at /opt/local/include/libavformat/avformat.h:789) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1339: warning: ‘guess_format’ is deprecated (declared at /opt/local/include/libavformat/avformat.h:789) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1367: warning: ‘av_alloc_format_context’ is deprecated (declared at /opt/local/include/libavformat/avformat.h:947) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1367: warning: ‘av_alloc_format_context’ is deprecated (declared at /opt/local/include/libavformat/avformat.h:947) 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:298: error: ‘InputArray’ has not been declared 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘bool cv::imwrite(const std::string&, int, const std::vector<int, std::allocator<int> >&)’: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:301: error: request for member ‘getMat’ in ‘_img’, which is of non-class type ‘int’ 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘void* cv::imdecode_(const cv::Mat&, int, int, cv::Mat*)’: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:312: error: ‘tempfile’ was not declared in this scope 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: At global scope: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: ‘cv::Mat cv::imdecode’ redeclared as different kind of symbol 
/opt/local/include/opencv2/highgui/highgui.hpp:107: error: previous declaration of ‘cv::Mat cv::imdecode(const cv::Mat&, int)’ 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: ‘InputArray’ was not declared in this scope 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:392: error: expected primary-expression before ‘int’ 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:399: error: ‘InputArray’ has not been declared 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp: In function ‘bool cv::imencode(const std::string&, int, std::vector<unsigned char, std::allocator<unsigned char> >&, const std::vector<int, std::allocator<int> >&)’: 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:402: error: request for member ‘getMat’ in ‘_image’, which is of non-class type ‘int’ 
/usr/share/src/OpenCV-2.3.1/modules/highgui/src/loadsave.cpp:427: error: ‘tempfile’ was not declared in this scope 
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/loadsave.o] Error 1 
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 

답변

3

the Wiki 제 2을 구축하는 사용 CMake의 지침을 시도해보십시오

mkdir build 
cd build 
cmake -G "Unix Makefiles" .. 
make -j8 
sudo make install 
+1

"make -j8" – Power

+0

에 같은 오류가 나타납니다. 아마도/usr/share/src/OpenCV-2.3.1을 제거하고 wiki의 지침에 따라 빌드하기 전에 tarball에서 클린 소스를 언팩해야합니다. –

+0

이것은 나에게도 효과적이다. 나는 또한 다른 소프트웨어가 fink를 사용하여 설치되었을 때 실패하는 것을 보았습니다. (이 경우에는 일시적으로 fink/sw 디렉토리를 다른 것으로 옮겼습니다. 그래서 cmake/make를 수행하는 동안 다양한 경로에서 찾을 수 없었습니다) – wrjohns

2

당신은 아마 이전에 충돌이 MacPorts의 설치. 실행 :

port installed opencv 

이 다음 OpenCV의 다른 버전을 발견 한 경우는 사용

sudo port deactivate opencv 

그런 다음 다시 만들어 실행합니다.

참고 : 이전 opencv 포트 설치에 의존했던 모든 것을 제동합니다. 따라서 이전 버전을 다시 활성화하거나 의존성을 조정하여 2.3.1을 사용해야합니다.

관련 문제