无法使用g ++编译opencv程序

时间:2015-12-04 01:01:37

标签: c++ opencv g++ raspberry-pi

我在这里做错了什么想法?

输入:

pi@raspberrypi ~/DisplayImage $ g++ DisplayImage.o -o DisplayImage `pkg-config --cflags opencv` `pkg-config --libs opencv`

输出:

/usr/bin/ld: warning: libopencv_core.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_imgproc.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_features2d.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_calib3d.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_highgui.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_ml.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_video.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_objdetect.so.2.4, needed by /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_contrib.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libopencv_core.a(rand.cpp.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.4'
//lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status

2 个答案:

答案 0 :(得分:0)

This answer反过来也有参数。

pkg-config opencv --libs

答案 1 :(得分:0)

如果您正在进行交叉编译,则可能需要pkg-config-arm-linux-gnueabi阅读类似帖子也可能会有所帮助Package opencv was not found in the pkg-config search path