📜  编译opencv程序——C编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:39.343000             🧑  作者: Mango

代码示例1
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/