opencv compile windows code example

Example: compile opencv program

prashad@ubuntu:~/$ g++  sample.cpp `pkg-config --cflags --libs opencv` 

NOTE: compiling any program for opencv , we need to add `pkg-config --flags --libs opencv` otherwise it prompts undefined references errors. to eliminate below errors please compile like above command.
Compilation errors:
open_videofile.cpp:(.text+0x53): undefined reference to `cv::VideoCapture::VideoCapture(cv::String const&)'
open_videofile.cpp:(.text+0x71): undefined reference to `cv::VideoCapture::isOpened() const'
open_videofile.cpp:(.text+0xca): undefined reference to `cv::VideoCapture::get(int) const'

tags: ubuntu, C++, opencv
usefull link: 
https://www.learnopencv.com/how-to-compile-opencv-sample-code/

Tags:

C Example