First time here? Check out the FAQ!
answered 2017-07-12 06:11:15 -0600
you are not linking any required opencv libraries. try like:
g++ myprog.cpp -lopencv_core -lopencv_imgproc -lopencv_videoio -lopencv_highgui -lopencv_objdetect -o myprog