简体   繁体   中英

Why does pkg-config --libs opencv return library locations and not the libraries themselves?

I am trying to compile a c++ program that incorporates OpenCV. I want to use pkg-config to make the compilation easier. However this does not work due to the fact that pkg-config -libs opencv returns the library locations and not the libraries themselves. I got:

/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so
/usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so
/usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so
...

While I am expecting something like

-L/usr/local/include/ -lopencv_contrib -lopencv_features2d ...

Have I screwed something up? If not, why has this happened? And can it be fixed?

The output of the pkg-config is correct.

The GNU linker (ld) (I don't know if others too) allows you to write the libraries with their full path, without any -L or -l, in addition to the usual -L and -l options.

The error must be in some other place.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM