在一些有用的提示之后,这是这篇文章的新版本,问题是我的程序似乎正在以某种方式运行,但它只是发出一些错误......我不知道它实际上提到了什么,因为安装了库,我将路径形式 LIBS += -LC:/usr/local/lib/ \
更改LIBS += -L/usr/local/lib/ \
为有人说它实际上是指 Windows 而你使用 linux(chakra) 然后在目录末尾添加“\”并将 pkg-config 添加到我的 .pro 文件中,所以这个是新版本的新问题...:
Starting /home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV...
/home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV exited with code 0
Debugging starts
the debug information found in "/usr/lib/libQtOpenGL.so.4.8.2.debug" does not match "/usr/lib/libQtOpenGL.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtGui.so.4.8.2.debug" does not match "/usr/lib/libQtGui.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtCore.so.4.8.2.debug" does not match "/usr/lib/libQtCore.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtTest.so.4.8.2.debug" does not match "/usr/lib/libQtTest.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtNetwork.so.4.8.2.debug" does not match "/usr/lib/libQtNetwork.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtXml.so.4.8.2.debug" does not match "/usr/lib/libQtXml.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtSvg.so.4.8.2.debug" does not match "/usr/lib/libQtSvg.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtDBus.so.4.8.2.debug" does not match "/usr/lib/libQtDBus.so.4" (CRC mismatch).
Debugging has finished
这是我的 .pro 配置 [如您所见,我评论了 (#) 两个 LIBS 配置之一,我只是想问哪个更准确或更有用,昨天我尝试过,它与较新版本的libavcodec 所以我搜索了一些并下载了 libavcodec.53 并对其进行了配置,但我不确定现在应该发生什么,我现在正试图从 ccr 社区存储库获取 opencv-qt-for-all 包并让程序自己处理这些问题,但我确信它不会解决我的问题]:
QT += core
QT -= gui
TARGET = FirstOpenCV
CONFIG += console
CONFIG -= app_bundle
CONFIG += link_pkgconfig
PKGCONFIG += opencv
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/opencv2/
#LIBS += -L/usr/local/lib/ \
#-libopencv_core.so \
#-libopencv_highgui.so \
#-libopencv_imgproc.so \
#-libopencv_features2d \
#-libopencv_calib3d.so
LIBS += /usr/lib/libopencv_core.so \
/usr/lib/libopencv_highgui.so \
/usr/lib/libopencv_imgproc.so \
/usr/lib/libopencv_features2d.so \
/usr/lib/libopencv_calib3d.so \
/usr/lib/libavcodec.so
这是代码:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main() {
// read an image
Mat image = imread("002.jpg");
// create image window named "My Image"
namedWindow("My Image");
// show the image on window
imshow("My Image", image);
// wait key for 5000 ms
waitKey(5000);
return 0;
}