1

I'm trying to compile OpenCV 3.1.0 on RHEL 6.4 and getting the following error:

[ 34%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o
/hpcf/libs/opencv/vendor/3.1.0-2/modules/highgui/src/window_gtk.cpp: In function ‘void cvImageWidget_realize(GtkWidget*)’:
/hpcf/libs/opencv/vendor/3.1.0-2/modules/highgui/src/window_gtk.cpp:167: error: ‘gtk_widget_set_realized’ was not declared in this scope
/hpcf/libs/opencv/vendor/3.1.0-2/modules/highgui/src/window_gtk.cpp: In function ‘void cvImageWidget_size_allocate(GtkWidget*, GtkAllocation*)’:
/hpcf/libs/opencv/vendor/3.1.0-2/modules/highgui/src/window_gtk.cpp:379: error: ‘gtk_widget_get_realized’ was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

We clearly have gtk as it shows in cmake:

--   GUI: 
--     QT:                          NO
--     GTK+ 2.x:                    YES (ver 2.18.9)
--     GThread :                    YES (ver 2.22.5)
--     GtkGlExt:                    NO
--     OpenGL support:              NO
--     VTK support:                 NO

So I'm not sure how to fix this problem. Does anyone have any ideas?

1

I know it's been a while, so if it helps:

I had the same error when I was compiling OpenCV 3.1.0 on RHEL. I looked up the code in highgui/src/window_gtk.cpp from OpenCV 2.4.3 branch. Do the following:

  • Replace "gtk_widget_set_realized" with "GTK_WIDGET_SET_FLAGS"
  • Replace "gtk_widget_get_realized" with "GTK_WIDGET_REALIZED"

Once I changed these, it worked.

0

Try installing the latest version of gcc

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 g++-4.9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.