[Solved] QFtp and qt5 linking problem



  • They have removed QFtp from qt5 and I've to download it and compile it myself.
    The project files for qftp:

    @TEMPLATE = subdirs

    module_qtftp_src.subdir = src
    module_qtftp_src.target = sub-src

    module_qtftp_examples.subdir = examples
    module_qtftp_examples.target = sub-examples
    module_qtftp_examples.depends = module_qtftp_src
    !contains(QT_BUILD_PARTS,examples) {
    module_qtftp_examples.CONFIG += no_default_install no_default_target
    }

    module_qtftp_tests.subdir = tests
    module_qtftp_tests.target = sub-tests
    module_qtftp_tests.depends = module_qtftp_src
    module_qtftp_tests.CONFIG = no_default_install
    !contains(QT_BUILD_PARTS,tests):module_qtftp_tests.CONFIG += no_default_target

    SUBDIRS += module_qtftp_src
    module_qtftp_examples
    # module_qtftp_tests \

    @

    project file in src:
    @
    TEMPLATE = subdirs

    SUBDIRS += qftp

    @

    and the qftp pro file:
    @
    load(qt_build_config)
    Template = lib
    TARGET = QtFtp
    CONFIG += static shared
    #CONFIG -= shared
    QT = core network

    MODULE_PRI = ../../modules/qt_ftp.pri
    MODULE = ftp

    load(qt_module)

    Input

    HEADERS += qftp.h qurlinfo.h
    SOURCES += qftp.cpp qurlinfo.cpp
    @

    This compiles and give me the dll I need. But the problem is when I want to use it in a project.

    I've got this in my project file:
    @
    #-------------------qtftp--------------------------
    QTFTP_PATH = ../3rdparty/qt5/qtftp
    CONFIG(debug, debug|release):QTFTPLIB = Qt5Ftpd
    CONFIG(release, debug|release):QTFTPLIB = Qt5Ftp
    INCLUDEPATH += $$QTFTP_PATH/src/qftp
    LIBS += -L$$QTFTP_PATH/lib
    -l$$QTFTPLIB

    #--------------------------------------------------
    @

    But after i run qmake it ads "500" to the lib and it gives me the following error

    c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Ftpd500

    if i open the make.debug I can se that qmake rename the qt5ftp lib to qt5ftp500.



  • Is there a configuration that tells qt to append the version number? It explains the numbers but not how they got there.


  • Moderators

    Hi,

    What do you wish to do with QFtp? QNetworkAccessManager has taken over some of QFtp's functionality: http://qt-project.org/forums/viewthread/27981 Would that suit your needs?



  • I'm porting a program from qt 4.8 to qt 5.1 and it uses QFtp.


  • Moderators

    I see.

    Try subscribing to the "Interest mailing list":http://lists.qt-project.org/mailman/listinfo/interest and asking your question there -- Qt's engineers are active on that list and they'll have better inside knowledge about these compatibility modules.



  • the shared library QtFtp created a prl file. I added this file:
    @CONFIG -= create_prl@
    And now it works as expected.



  • Hello
    In my case i not seeing

    #include <QtFtp> or <QFtp>

    but only

    #include <QtFtp/QtFtpDepends>



  • I compiled qftp into a shared library and linked the main application to the library.

    this is the .pro file for qftp
    @load(qt_build_config)
    Template = lib
    TARGET = QtFtp
    CONFIG += shared
    CONFIG -= create_prl
    QT = core network
    CONFIG += no_install_prl
    MODULE_PRI = ../../modules/qt_ftp.pri
    MODULE = ftp

    load(qt_module)

    Input

    HEADERS += qftp.h qurlinfo.h
    SOURCES += qftp.cpp qurlinfo.cpp
    @



  • I have install QT 5.1.1
    download from git https://qt.gitorious.org/qt/qtftp

    extract to:
    C:\Qt\5.1.1\5.1.1\Src\qt-qtftp

    edit qftp.pro
    @
    load(qt_build_config)
    Template = lib
    TARGET = QtFtp
    CONFIG += shared
    CONFIG -= create_prl
    QT = core network
    CONFIG += no_install_prl
    MODULE_PRI = ../../modules/qt_ftp.pri
    MODULE = ftp

    load(qt_module)

    Input

    HEADERS += qftp.h qurlinfo.h
    SOURCES += qftp.cpp qurlinfo.cpp"@

    go to VC console.

    cd c:\Qt\5.1.1\5.1.1\Src\qt-qtftp\src\qftp
    qmake qftp.pro
    nmake
    nmake install

    after when I run examples from git qtftp i have this error

    C:\Qt\5.1.1\5.1.1\msvc2010_opengl\examples\network\qftp\ftpwindow.cpp:43: błąd:C1083: Cannot open include file: 'QtFtp': No such file or directory



  • I included qftp.h from library I build.



  • Could you point me step by step how to do this.
    I am a beginner programmer QT.

    I copy qftp.h and qurlinfo.h to ftp example project,
    and
    add to qftp.pro
    line HEADERS += qftp.h qurlinfo.h

    but when i run project i have many errors like:

    C:\Qt\5.1.1\5.1.1\msvc2010_opengl\examples\network\build-qftp-Desktop_Qt_5_1_1_MSVC2010_32bit_OpenGL-Debug\debug\moc_qftp.cpp:125: błąd:C2027: use of undefined type
    'QFtpPrivate'
    c:\qt\5.1.1\5.1.1\msvc2010_opengl\examples\network\qftp\qftp.h:51: see declaration of 'QFtpPrivate'
    ...

    first error go to
    case 9: _t->d->_q_startNextCommand(); break;



  • I can write more details about how to do this after work.



  • Hello
    It's work

    1. build source qt-qtftp
      qmake /Src/qt-qtftp/src/src.pro
      nmake
      nmake install

    after
    change in qt-qtftp/src/qftp/qftp.pro

    @ CONFIG -= static
    CONFIG += shared@

    and compile again

    in lib a have now
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftp.dll
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftpd.dll
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftp.lib
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftpd.lib
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftpd.pdb
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftp.prl
    c:\Qt\5.1.1\5.1.1\msvc2010_opengl\lib\Qt5Ftpd.prl

    1. create file in directory
      c:\Qt\5.1.1\5.1.1\msvc2010_opengl\include\QtNetwork
      QFtp
      and inside add
      @#include "qftp.h"@

    2. copy from source two file
      qftp.h and qurlinfo.h to includes\QtNetwork\

    3. in my project add
      @LIBS += Qt5Ftp.lib@
      and
      @QT += ftp@

    and project finaly build and run:) jupiiii


  • Moderators

    Thank you for sharing your solution!



  • Hello, I'm on Linux and I have the same problem. Compile the module as shared and static and in no way I can compile the examples. When you modified the .pro filedo not miss you put a -L parameter?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.