重裝系統和opencv,編譯運行顯示一副圖像的程序,報錯如下
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,運行不了,仔細看。
我們進入到opencv源代碼庫,找到highgui庫下面,具體路徑“/home/liurf/opencv/modules/highgui”,依次運行“cmake .”,"make -j4","sudo make install",之后再進入我們的程序下面重新編譯運行就一切正常了。
每次編譯opencv都會出現,解決了就沒管它,還是記下來省得百度浪費時間。