Ask Your Question

Revision history [back]

I had the same problem when reading "opencv by example" book. I tried many different things, and finally figured out that it was because of a linker issue, as described here: see here

Basically, you just need to change the command to

g++ -ggdb opencv_version.cpp `pkg-config --cflags --libs opencv3` -o /tmp/opencv_version && /tmp/opencv_version

Then it will work!!!

By the way, I also added the library path "/full/path/to/opencv-3.0.0/build/lib" to LD_LIBRARY_PATH in ~/.profile. Otherwise, there is an error about shared library.