2011-09-14 6 views
2

OpenCVのWebサイトから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 

再度makeを実行します。

注:以前のopencv portsのインストールに依存していたものは、すべて停止します。だから、古いものをもう一度アクティブにしたり、依存関係を調整して2.3.1を使う必要があります。

関連する問題