pkg-config

wiki

pkg-config.org

其它参考链接

事情是这样子的

编译opencv下的sample/cpp文件夹下的stitching.cpp文件

g++ `pkg-config --cflags --libs opencv` --std=c++11 stitching.cpp

提示未定义的引用

g++ -std=c++11 stitching.cpp -L /usr/local/lib/*.so

改用上述编译命令成功编译

/usr/local/lib/pckconfig/opencv.hc内容如下

# Package Information for pkg-config

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 3.3.0
Libs: -L${exec_prefix}/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_dnn -lopencv_ml -lopencv_shape -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudawarping -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_video -lopencv_objdetect -lopencv_imgproc -lopencv_flann -lopencv_cudaarithm -lopencv_core -lopencv_cudev
Libs.private: -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lgthread-2.0 -L/usr/lib/x86_64-linux-gnu -lpng -lz -ltiff -ljasper -ljpeg -ldc1394 -lavcodec-ffmpeg -lavformat-ffmpeg -lavutil-ffmpeg -lswscale-ffmpeg -ldl -lm -lpthread -lrt -lcudart -lnppc -lnppi -lnpps -lcufft -L-L/usr/local/cuda-8.0 -l64
Cflags: -I${includedir_old} -I${includedir_new}

原因应该是opencv.hc链接库没写全

posted @ 2018-01-07 22:57  我在地狱  阅读(887)  评论(0编辑  收藏  举报