http://stackoverflow.com/questions/7816607/opencv-2-3-compiling-issue-undefined-refence-ubuntu-11-10
I am guessing that at least some of the libraries in the output of
pkg-config opencv --libs
are archive libraries. It is incorrect to put archive libraries before sources that need them (test_1.cpp
in this case): the order of sources and libraries on the link line matters.
Try
g++-o test_1 test_1.cpp `pkg-config opencv --cflags --libs`