Ask Your Question
0

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

asked 2015-07-02 04:50:13 -0600

franken gravatar image

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

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...

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 :)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2015-07-02 04:57:40 -0600

LorenaGdL gravatar image

You're mixing OpenCV 2.4.10 and 3.0.0. The link in that tutorial points to the master branch of the GitHub repo, which contains right now 3.0.0 files. That's why you don't have in your installation the videoio.hpp file and why the compilation error arises. Either upgrade your version to 3.0.0 or use the code included in the tutorial webpage (found also here)

edit flag offensive delete link more

Comments

thanks bro ... i'm just a newbie so i installed firstly opencv 3.0.0 first and i have found a lot of difficulties to find some examples on face detection so i switched to opencv 2.4.10 .... i have tested the code that i have posted in opencv 3 and it worked and for now i have tested the code you have posted and it worked in opencv 2. thanks a lot :)

franken gravatar imagefranken ( 2015-07-03 05:01:06 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-07-02 04:50:13 -0600

Seen: 1,546 times

Last updated: Jul 02 '15