gpt4 book ai didi

qt - 无法使用Qt环境在Linux中解析库

转载 作者:行者123 更新时间:2023-12-02 17:53:45 25 4
gpt4 key购买 nike

经过一些有用的提示后,这是本文的新版本,问题是我的程序似乎正在以某种方式运行,但是它只会发出一些错误...我不知道它实际上在说什么,因为已安装了库,我将路径形式LIBS + =-LC:/usr/local/lib/ \更改为LIBS += -L/usr/local/lib/ \,因为有人说它实际上是在您使用linux(chakra)时引用Windows,然后在目录末尾添加“\”,并将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;
}

最佳答案

尝试:

QT       += core

QT -= gui

TARGET = FirstOpenCV
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp

INCLUDEPATH += /usr/local/include/opencv2/

LIBS += -LC:/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_features2d \
-lopencv_calib3d

关于qt - 无法使用Qt环境在Linux中解析库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12617222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com