I am trying to build the program at http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html after installing OpenCV on my machine. I try to compile it using g++ display_image.cpp -o DisplayImage but I get the following error:
display_image.cpp:(.text+0x9d): undefined reference to `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
I think this has to do with how I'm compiling the program (some unresolved reference to opencv2) but I don't know how to resolve it. I'm using Ubuntu 13.04. Thanks!
Edit: I realize this is similar to OpenCV 2.3 Compiling Issue - Undefined Refence - Ubuntu 11.10 but I don't really understand the use of pkg-config opencv --cflags --libs and how to avoid it
pkg-config [package] --cflags --libsreturns the compiler flags and libraries that you need to add to gcc command in order to use[package]in your computer. You can avoid the use if you already know the output of that command and use it directly