2013-07-23 60 views
0

我想在我的机器上安装OpenCV后在http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html上构建程序。我尝试使用g++ display_image.cpp -o DisplayImage编译它,但我得到了以下错误:如何构建简单的OpenCV程序

display_image.cpp:(.text+0x9d): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' 

我觉得这与我如何编译程序(一些未解决的参考opencv2)做,但我不知道该怎么解决它。我使用的是Ubuntu 13.04。谢谢!

编辑:我意识到这是类似于OpenCV 2.3 Compiling Issue - Undefined Refence - Ubuntu 11.10但我真的不明白使用pkg-config opencv --cflags --libs,以及如何避免它

+1

看起来你忘了-l或-L与OpenCV的LIB链接链接你的样品.... [OpenCV的2.3编译发行的 – alexbuisson

+0

可能重复 - 未定义Refence - Ubuntu 11.10](http://stackoverflow.com/questions/781 6607/opencv-2-3-compiling-issue-undefined-refence-ubuntu-11-10) – alexbuisson

+0

你无法避免使用pkg-config ... – alexbuisson

回答

相关问题