重裝系統和opencv,編譯運行顯示一副圖像的程序,報錯以下ubuntu
1 liurf@liurf-Lenovo-G470:~/WorkSpace/slambook-master/ch5/imageBasics$ ./imageBasics ubuntu.png 2 圖像寬爲1200,高爲674,通道數爲3 3 OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /home/liurf/opencv/modules/highgui/src/window.cpp, line 501 4 terminate called after throwing an instance of 'cv::Exception' 5 what(): /home/liurf/opencv/modules/highgui/src/window.cpp:501: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage 6 7 已放棄 (核心已轉儲)
根據提示安裝gtk2.0和pkg-config,運行不了,仔細看。ui
咱們進入到opencv源代碼庫,找到highgui庫下面,具體路徑「/home/liurf/opencv/modules/highgui」,依次運行「cmake .」,"make -j4","sudo make install",以後再進入咱們的程序下面從新編譯運行就一切正常了。spa
每次編譯opencv都會出現,解決了就沒管它,仍是記下來免得百度浪費時間。code