gpt4 book ai didi

c++ - 检查库并在 opencv 中编译

转载 作者:太空宇宙 更新时间:2023-11-03 23:02:33 25 4
gpt4 key购买 nike

我输入这个命令来检查opencv中安装了哪些库,

pkg-config --libs opencv

我得到了以下输出:

/usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.s
/usr/local/lib/libopencv_feature2d.so
/usr/local/lib/libopencv_flann.so
/usr/local/lib/libopencv_gpu.so
/usr/local/lib/libopencv_highgui.so
/usr/local/lib/libopencv_imgproc.so
/usr/local/lib/libopencv_legacy.so
/usr/local/lib/libopencv_ml.so
/usr/local/lib/libopencv_nonfree.so
/usr/local/lib/libopencv_objdetect.so
/usr/local/lib/libopencv_photo.so
/usr/local/lib/libopencv_stitching.so
/usr/local/lib/libopencv_ts.so
/usr/local/lib/libopencv_video.so
/usr/local/lib/libopencv_videostab.so

为了编译一个从文件中读取视频的文件,我应该给出什么适当的命令?

我试过使用 g++ -I/usr/include/opencv -lxcore -lhighgui -lm nameoffile.cpp但我一直收到错误,/usr/lib/ld cannot find -lxcore etc...

最佳答案

你可以尝试使用pkg-config --cflags --libs libname然后你就可以这样写了

g++ -I/usr/include/opencv -lxcore -lhighgui -lm nameoffile.cpp `pkg-config --cflags --libs opencv`

这样你就可以包含你想要链接的库的路径

关于c++ - 检查库并在 opencv 中编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13703853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com