I'm compiling the code with custom compiled opencv library. So I can't use "pkg-config --cflags --libs opencv" to do the work.
library structure:
/c/Users/kmes40505/Desktop/programming/library/opencv/include
/c/Users/kmes40505/Desktop/programming/library/opencv/x64/vc14/lib
/c/Users/kmes40505/Desktop/programming/library/opencv/x64/vc14/bin
g++ command I tried:
g++ test.cpp -I/c/Users/kmes40505/Desktop/programming/library/opencv/include -L/c/Users/kmes40505/Desktop/programming/library/opencv/x64/vc14/lib -lopencv_calib3d -lopencv_calib3dd -lopencv_contrib -lopencv_contribd -lopencv_core -lopencv_cored -lopencv_features2d -lopencv_features2dd -lopencv_flann -lopencv_flannd -lopencv_gpu -lopencv_gpud -lopencv_highgui -lopencv_highguid -lopencv_imgproc -lopencv_imgprocd -lopencv_legacy -lopencv_legacyd -lopencv_ml -lopencv_mld -lopencv_nonfree -lopencv_nonfreed -lopencv_objdetect -lopencv_objdetectd -lopencv_ocl -lopencv_ocld -lopencv_photo -lopencv_photod -lopencv_stitching -lopencv_stitchingd -lopencv_superres -lopencv_superresd -lopencv_ts -lopencv_tsd -lopencv_video -lopencv_videod -lopencv_videostab -lopencv_videostabd
but I got errors when I comiile:
undefined reference to \`cv::VideoCapture::VideoCapture()'
undefined reference to \`cv::VideoCapture::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
The error info:
undefined reference to \`cv::VideoCapture::VideoCapture()'
undefined reference to \`cv::VideoCapture::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Notice, std::__cxx11::basic_string
means std::string
in C++ 11.
Maybe you should add the flag: -std=c++11
after g++.
Try this :
g++ -std=c++11 test.cpp -I/c/Users/kmes40505/Desktop/programming/library/opencv/include -L/c/Users/kmes40505/Desktop/programming/library/opencv/x64/vc14/lib -lopencv_calib3d -lopencv_calib3dd -lopencv_contrib -lopencv_contribd -lopencv_core -lopencv_cored -lopencv_features2d -lopencv_features2dd -lopencv_flann -lopencv_flannd -lopencv_gpu -lopencv_gpud -lopencv_highgui -lopencv_highguid -lopencv_imgproc -lopencv_imgprocd -lopencv_legacy -lopencv_legacyd -lopencv_ml -lopencv_mld -lopencv_nonfree -lopencv_nonfreed -lopencv_objdetect -lopencv_objdetectd -lopencv_ocl -lopencv_ocld -lopencv_photo -lopencv_photod -lopencv_stitching -lopencv_stitchingd -lopencv_superres -lopencv_superresd -lopencv_ts -lopencv_tsd -lopencv_video -lopencv_videod -lopencv_videostab -lopencv_videostabd
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.