Project-->Properties-->C/C++Build-->Settings-->GCC C++ Compiler-->Includes
添加/usr/local/include/opencv。

GCC C++ Linker-->Libraries 中Library search path中添加 /usr/local/lib;Libraries 中添加opencv_cv、opencv_cxcore、opencv_highgui。
点编译运行。(之前在Debug文件夹下放一张图片image.jpg)如果一切顺利的话会看到如下结果:

如果出现红色的提示像我一样。。。就按提示来吧。。。。
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 /media/myprogram/OpenCV_2_3_src/modules/highgui/src/window.cpp, line 293
terminate called after throwing an instance of 'cv::Exception'
what(): /media/myprogram/OpenCV_2_3_src/modules/highgui/src/window.cpp:293: 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
安装libgtk2.0-dev和pkg-config
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config
装好之后第4步再来一遍,至少我的经过这样就好了。
初学OpenCV,多多指教。
