2016-12-07 18:51:07 -0600 answered a question g++ error: undefined reference to CommandLineParser 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. 2016-12-07 12:31:23 -0600 received badge ● Supporter (source)