Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Compilation error : error: declaration of ‘operator>>’ as non-function

Hi all , i'm trying to build an example file found here : http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html

it need a file called videoio.hpp that doesn't exist in opencv2 folder so i have download it from https://github.com/Itseez/opencv/blob/master/modules/videoio/include/opencv2/videoio.hpp

when building the source file i get the folllowing errors :

compiling objectDetection.cpp In file included from objectDetection.cpp:3:0: /usr/local/include/opencv2/videoio.hpp:454:47: error: declaration of ‘operator>>’ as non-function virtual VideoCapture& operator >> (CV_OUT UMat& image); ^ /usr/local/include/opencv2/videoio.hpp:454:36: error: expected ‘;’ at end of member declaration virtual VideoCapture& operator >> (CV_OUT UMat& image); ^ /usr/local/include/opencv2/videoio.hpp:454:51: error: expected ‘)’ before ‘&’ token virtual VideoCapture& operator >> (CV_OUT UMat& image); ^ /usr/local/include/opencv2/videoio.hpp:618:42: error: expected initializer before ‘<’ token template<> CV_EXPORTS void DefaultDeleter<cvcapture>::operator ()(CvCapture* obj) const; ^ /usr/local/include/opencv2/videoio.hpp:619:42: error: expected initializer before ‘<’ token template<> CV_EXPORTS void DefaultDeleter<cvvideowriter>::operator ()(CvVideoWriter* obj) const; ^ In file included from objectDetection.cpp:4:0: /usr/local/include/opencv2/highgui/highgui.hpp:204:20: error: redefinition of ‘class cv::VideoCapture’ class CV_EXPORTS_W VideoCapture ^ In file included from objectDetection.cpp:3:0: /usr/local/include/opencv2/videoio.hpp:380:20: error: previous definition of ‘class cv::VideoCapture’ class CV_EXPORTS_W VideoCapture ^ In file included from objectDetection.cpp:4:0: /usr/local/include/opencv2/highgui/highgui.hpp:230:20: error: redefinition of ‘class cv::VideoWriter’ class CV_EXPORTS_W VideoWriter ^ In file included from objectDetection.cpp:3:0: /usr/local/include/opencv2/videoio.hpp:534:20: error: previous definition of ‘class cv::VideoWriter’ class CV_EXPORTS_W VideoWriter

i'm using opencv 2.4.10 thanks for your help :)