对 `_imp___ZN10HTTPClient5abortEv' 和其他人的未定义引用 [英] undefined reference to `_imp___ZN10HTTPClient5abortEv' and others

查看:42
本文介绍了对 `_imp___ZN10HTTPClient5abortEv' 和其他人的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个庞大的项目从 Qt 4.x 迁移到 5,我快完成了,但是我遇到了无法定位的错误,我认为这与某些库的链接有关,但我在这里有些迷失.我希望有人可以对这个问题有所了解.

I am migrating a huge project from Qt 4.x to 5, I am almost finished but Im having errors that I cannot locate, I think it has to do with the linkage of some libraries but I am somewhat lost here. I hope someone can throw some light on this matter.

错误:

  ./release\addeditaton.o:addeditaton.cpp:(.text+0x6ac2): undefined reference to `_imp___ZN10HTTPClient5abortEv'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0x98c5): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0x9f88): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xa7a8): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xa921): undefined reference to `_imp___ZN10RestClientC2E7QStringibS0_S0_S0_S0_'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xc91b): undefined reference to `_imp___ZN10HTTPClient3getE7QStringbb'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xcaa3): undefined reference to `_imp___ZN10RestClientC2E7QStringibS0_S0_S0_S0_'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xe49d): undefined reference to `_imp___ZN10HTTPClient4postE7QStringS0_b'
    ./release\addeditaton.o:addeditaton.cpp:(.text+0xfc55): undefined reference to `_imp___ZN10HTTPClient4postE7QStringS0_b'
    Makefile.Release:922: recipe for target '..\Release\Swibz.exe' failed
    c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\addeditaton.o: bad reloc address 0x20 in section `.text$_ZN10QByteArrayD1Ev[__ZN10QByteArrayD1Ev]'

项目文件:

# ----------------------------------------------------
# This file is generated by the Qt Visual Studio Add-in.
# ------------------------------------------------------

TEMPLATE = app
TARGET = Swibz
include(Swibz.pri)
DESTDIR = ../Release
QT += widgets network xml webkit webkitwidgets opengl #core gui are by default
CONFIG += release
DEFINES += _WINDOWS QT_LARGEFILE_SUPPORT QT_XML_LIB QT_OPENGL_LIB QT_NETWORK_LIB QT_DLL QWT_DLL JSON_LIB_LIB
INCLUDEPATH += ../../../SprintLib \
    ./GeneratedFiles \
    ./GeneratedFiles/Release \
    . \
    #./../../Qwt/qwt-5.2.0/src \
    ../qwt/src \
    #../../../QENC/QENC \
    ../qenc \
   # ../../../zlib-1.2.5 \
    ../zlib-1.2.5 \
    #../../../serial/qextserialport-1.2win-alpha \
    ../qextserialport-1.2win-alpha \
   # ../../../qxmpp-0.3.0/src \
    ../qxmpp/build-qxmpp-Qt_4_8_5-Debug/src \
    #../../../JSON \
    ../json/JSON \
   # ../../../QtSerialPort/qtserialport/include
    ../QtSerialPort/qtserialport/include
LIBS += -L"../../../SprintLib/release" \
    -L"../../../QENC/release" \
    -L"../../../zlib-1.2.5/contrib/vstudio/vc9/x86/ZlibDllRelease" \
    -L"../../../serial/qextserialport-1.2win-alpha/Release" \
    -L"../../../qxmpp-0.3.0/lib" \
    -L"../../../JSON/Release" \
    -L"../../../QtSerialPort/qtserialport/src/serialport/release" \
    -lopengl32 \
    -lglu32 \
    -lgdi32 \
    -luser32 \
    #-lHDP \
    -L"./libHDP.a" \
    #-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
    #-lqenc \
    #-lzlibwapi \
    -L"./zlib1.dll" \
    #-lqextserialport \
    -lsetupapi \
    #-lqxmpp \
    -L"./libqxmpp.a" \
    #-ljson_lib \
    #-lSerialPort1
    -L"./libqextserialportd.a" \
#DEPENDPATH += .
#MOC_DIR += ./GeneratedFiles/release
#OBJECTS_DIR += release
#UI_DIR += ./GeneratedFiles
#eRCC_DIR += ./GeneratedFiles
#win32:RC_FILE = Swibz.rc

TRANSLATIONS = ln_en.ts
TRANSLATIONS = ln_lv.ts
TRANSLATIONS = ln_lt.ts
TRANSLATIONS = ln_es.ts

CODECFORTR     = UTF-8

包括 addeditaton.cpp(如果需要其余代码,请告诉,它们是 930 行,我认为它们与问题无关(

Includes of addeditaton.cpp (if the rest of the code is needed please tell, they are 930 lines and I dont think they are relevant to the issue(

#include "addeditaton.h"
#include "atonwidget.h"
#include "atoninfowidget.h"
#include "messagebox.h"

#include <QtDebug>
#include <QFileDialog>

推荐答案

./release\addeditaton.o: addeditaton.cpp:(.text+0x6ac2): 未定义的对 `_imp___ZN10HTTPClient5abortEv' 的引用

./release\addeditaton.o:addeditaton.cpp:(.text+0x6ac2): undefined reference to `_imp___ZN10HTTPClient5abortEv'

这样的行通常意味着至少有以下问题之一:

Lines like that usually means at least either of the following issues:

  • 您没有安装相应的库.

  • You do not have the corresponding library installed.

您没有使用您依赖的符号安装正确的版本.

You do not have the correct version installed with the symbols you rely on.

您的链接选项设置不正确.

Your linkage options are not set up properly.

在这种情况下,抱怨是关于 http 客户端库,所以让我们先检查您的项目文件.您在开始时正确使用了 -L-l 选项,但最后却没有使用,所以让我们澄清一下它们的含义:

In this case, the complain is about the http client library, so let us check your project file first. You are using the -L and -l options correctly in the beginning, but not in the end, so let us clarify what they mean:

-L 表示库的路径.

-l 表示库名或库的绝对路径.

-l either means the library name or absolute path to the library.

现在,让我们看看你在问题所在的最后写了什么:

Now, let us see what you write at the end where the issue is:

-L"./libHDP.a" \
#-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
#-lqenc \
#-lzlibwapi \
-L"./zlib1.dll" \
#-lqextserialport \
-lsetupapi \
#-lqxmpp \
-L"./libqxmpp.a" \
#-ljson_lib \
#-lSerialPort1
-L"./libqextserialportd.a" \

因此,您应该将其替换为以下内容:

Therefore, you should replace this with the following:

-lHDP
#-l../../Qwt/qwt-5.2.0/lib/debug/qwt5 \
#-lqenc \
#-lzlibwapi \
-lzlib1 \
#-lqextserialport \
-lsetupapi \
#-lqxmpp \
-lqxmpp.a \
#-ljson_lib \
#-lSerialPort1 \
-lqextserialportd

或者,您也可以使用上述 -l 选项指定静态库的绝对路径.

Alternatively, you could also specify the absolute path to the static libraries with the -l option as mentioned above.

请注意,您不应该在您的项目中混淆 QtSerialPort 和 QextSerialPort 之类的东西.最好使用 QtSerialPort.

Note that you should not mix up things like QtSerialPort and QextSerialPort in your project, however. It is better to use QtSerialPort.

这篇关于对 `_imp___ZN10HTTPClient5abortEv' 和其他人的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆