1

我输入了这个命令来检查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...

4

1 回答 1

1

你可以尝试使用pkg-config --cflags --libs libname 然后你可以写这样的东西

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

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

于 2012-12-04T13:23:03.717 回答