简体   繁体   中英

Project with openCV won't build because of opencv dependencies

I had build OpenCV from source without any errors.

Then I tried using OpenCV in a project and it won't compile because of the dependencies. All the libraries in the warning are installed but have different versions (actually, no versions' numbers added after .a and .so names).

Here's the compiling errors:

/usr/bin/ld: warning: libavcodec.so.53, needed by /usr/lib/i386-linux-gnu/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavformat.so.53, needed by /usr/lib/i386-linux-gnu/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libavutil.so.51, needed by /usr/lib/i386-linux-gnu/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libswscale.so.2, needed by /usr/lib/i386-linux-gnu/libopencv_highgui.so, not found (try using -rpath or -rpath-link)

How do I get rid of the errors? And why do they occur?

Compilation command:

g++ -std=c++11 -Wall -gdwarf-3 -o dist/Debug/GNU-Linux-x86/rankcollection build/Debug/GNU-Linux-x86/QueryCollection.o build/Debug/GNU-Linux-x86/main.o -L/usr/local/lib -L/usr/lib/i386-linux-gnu -lboost_filesystem -lopencv_core -lboost_program_options -lopencv_imgproc -lopencv_features2d -lopencv_flann -lopencv_nonfree -lboost_system -lopencv_highgui -std=c++11

Downgrading Boost from 1.57 to 1.55 has helped.

But I still have no idea why I had the problem to begin with.

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