0

I use Qt5.12.0, Qt Creator 4.8.0. So it doesn't contain QFtp but I need to use it. So I follow the way I found on the Internet, I put the .h, .lib, .prl, .dll files of Qt5Ftp to the corresponding directories in 'Qt\Qt5.12.0\5.12.0\msvc2017_64'. Then I built my project, the compiling process is successful, but there's an error in the linking process—

LINK : fatal error LNK1181: cannot open input file 'Qt5Ftp.obj'

I'd tried to rerun qmake, clean all, rebuild all, etc, everything I could try, but I still got this error.

Here's the content of the .pro file of my project—

QT       += core gui network webenginewidgets
CONFIG   += c++11

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

include(qtsingleapplication/src/qtsingleapplication.pri)

TARGET = YunQuBrowser
TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS

SOURCES += main.cpp\
        mainwindow.cpp \
    webview.cpp \
    webpage.cpp \
    ftpclient.cpp \
    logfile.cpp \
    cmdconfig.cpp

HEADERS  += mainwindow.h \
    webview.h \
    webpage.h \
    ftpclient.h \
    logfile.h \
    cmdconfig.h \
    common.h

INCLUDEPATH += ./include

FORMS    += mainwindow.ui

RESOURCES += \
    YunQuBrowser.qrc \

RC_FILE = YunQuBrowserDesktopIcon.rc

CONFIG(debug, debug|release) {
    LIBS += Qt5Ftpd
} else {
    LIBS += Qt5Ftp
}
Yadid
  • 31
  • 4
  • As you probably know, using a deprecated module isn't the best possible idea... The recommended way is to use `QNetworkAccessManger` instead. However, without your .PRO file(s), it will be quite difficult to help you... – Wisblade Mar 21 '22 at 06:39
  • Haha, thank you, Wisblade. You're right, using the obsolete feature is not a good idea. But if I replace the QFtp with QNetworkAccessManger in my project, it'll take a long time[Lol] Anyway, how about showing the .pro file first, after all fixing the problem in it is also a way to study haha. – Yadid Mar 21 '22 at 08:32
  • Excepted the missing "-l" (lowcase "L") before `Qt5Ftp` for the `LIBS+=` lines (and the missing `LIBS += -L`, I don't see anything else strange... Try this first. – Wisblade Mar 21 '22 at 11:17
  • Wow! You've fixed this problem, Wisblade, awesome! I changed the setting of the .pro file to `LIBS += -L"QFtp/qtftp_lib/Qt5Ftp.lib"` (path of my project), and that error didn't occur. However, a bunch of 'unresolved external symbol' new errors occurred, mainly related to the QFtp. Oh I think I should read some books about Qt Creator first, for all the errors I encountered seems too simple. Thank you for helping me, Wisblade:) – Yadid Mar 22 '22 at 06:02

1 Answers1

0

The last comment I post contains a mistake. The correct way is to change the whole CONFIG block into LIBS += -L"QFtp/qtftp_lib", which should be a directory, but not a path of a .lib file.

Yadid
  • 31
  • 4