Ikemesit Ansa
Ikemesit Ansa

Reputation: 133

checking libraries and compiling in opencv

I typed in this command to check what libraries are installed in opencv,

pkg-config --libs opencv

I got the following output:

/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

What is the appropraite command I should give in order to compile a file that reads a video from file?

I've tried using g++ -I/usr/include/opencv -lxcore -lhighgui -lm nameoffile.cpp but I keep getting the error, /usr/lib/ld cannot find -lxcore etc...

Upvotes: 1

Views: 804

Answers (1)

phschoen
phschoen

Reputation: 2081

you can try to use pkg-config --cflags --libs libname then you can write somthing like this

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

that way you can include the paths to the libs you want to link

Upvotes: 1

Related Questions