Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with <QNetworkReply>



  • Hello,

    I've a problem when I build my project I get an error erreur : QNetworkReply: No such file or directory, this problem doesn't show during compilation, however when I click on run the I get this message, and by the way I've already added the network component to the .pro file.



  • Thank you everyone, I've solved, I changed to qt 5.14.2 and I've found the problem with a another variable, it had nothing to do with QNetworkReply


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    There's something not clear in your question. "Build" and "compilation" are related as compilation is part of the build process.

    Can you explain when and where exactly you see this error ?



  • @SGaist Thx for answering me, well, if I just click on compile the project in left pane the error won't appear, however when I click on run (green arrow) in the bottom left pane I get the error message


  • Lifetime Qt Champion

    Hi
    Do you have
    QT += network
    in the .pro file ?
    if not, add it and run qmake from the build menu and then try run again



  • @mrjj thx for your anwser, yup I do have, I've already mentioned it


  • Lifetime Qt Champion

    @Achille15 Please show us your .pro-file


  • Lifetime Qt Champion

    @Achille15
    Ah sorry, i missed that part.
    Also, might be a silly question but you do have
    #include <QNetworkReply> in the file where it complains ?



  • @mrjj it's ok, I know it's the obvious solution, yes I do have the #include<QNetworkReply>


  • Lifetime Qt Champion

    @Achille15
    Ok. had to ask :)

    Does it really say "QNetworkReply: No such file or directory" ?

    Then im not really sure what could be wrong.

    Do you have the file ?
    "C:\Qt\5.15.1\msvc2019_64\include\QtNetwork\qnetworkreply.h"


  • Lifetime Qt Champion

    Please post your pro-file.



  • @Christian-Ehrlicher
    #-------------------------------------------------

    Project created by QtCreator 2019-12-29T19:35:37

    #-------------------------------------------------

    QT -= gui
    QT += sql network

    TARGET = cm-lib
    TEMPLATE = lib

    CONFIG += c++14

    DEFINES += CMLIB_LIBRARY

    The following define makes your compiler emit warnings if you use

    any feature of Qt which has been marked as deprecated (the exact warnings

    depend on your compiler). Please consult the documentation of the

    deprecated API in order to know how to port your code away from it.

    DEFINES += QT_DEPRECATED_WARNINGS

    You can also make your code fail to compile if you use deprecated APIs.

    In order to do so, uncomment the following line.

    You can also select to disable deprecated APIs only up to a certain version of Qt.

    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    INCLUDEPATH += source

    SOURCES +=
    source/controllers/command-controller.cpp
    source/controllers/database-controller.cpp
    source/controllers/master-controller.cpp
    source/data/data-decorator.cpp
    source/data/datetime-decorator.cpp
    source/data/entity.cpp
    source/data/enumerator-decorator.cpp
    source/data/int-decorator.cpp
    source/data/string-decorator.cpp
    source/framework/command.cpp
    source/models/address.cpp
    source/models/appointment.cpp
    source/models/client-search.cpp
    source/models/client.cpp
    source/models/contact.cpp
    source/networking/network-access-manager.cpp
    source/networking/web-request.cpp

    HEADERS +=
    source/controllers/command-controller.h
    source/controllers/database-controller.h
    source/controllers/master-controller.h
    source/controllers/navigation-controller.h
    source/controllers/i-database-controller.h
    source/data/data-decorator.h
    source/data/datetime-decorator.h
    source/data/entity-collection.h
    source/data/entity.h
    source/data/enumerator-decorator.h
    source/data/int-decorator.h
    source/data/string-decorator.h
    source/framework/command.h
    source/models/address.h
    source/models/appointment.h
    source/models/client-search.h
    source/models/client.h
    source/cm-lib_global.h
    source/models/contact.h
    source/networking/i-network-access-manager.h
    source/networking/i-web-request.h
    source/networking/network-access-manager.h
    source/networking/web-request.h

    include(../qmake-target-platform.pri)
    include(../qmake-destination-path.pri)

    DESTDIR = $$PWD/../binaries/$$DESTINATION_PATH
    OBJECTS_DIR = $$PWD/build/$$DESTINATION_PATH/.obj
    MOC_DIR = $$PWD/build/$$DESTINATION_PATH/.moc
    RCC_DIR = $$PWD/build/$$DESTINATION_PATH/.qrc
    UI_DIR = $$PWD/build/$$DESTINATION_PATH/.ui

    unix {
    target.path = /usr/lib
    INSTALLS += target
    }


  • Lifetime Qt Champion

    @mrjj said in Problem with <QNetworkReply>:

    Do you have the file ?
    "C:\Qt\5.15.1\msvc2019_64\include\QtNetwork\qnetworkreply.h"

    And the file "C:\Qt\5.15.1\msvc2019_64\include\QtNetwork\QNetworkReply" ?



  • @mrjj I am using gcc compiler
    Sans titre.png



  • @Achille15 said in Problem with <QNetworkReply>:

    this problem doesn't show during compilation, however when I click on run the I get this message

    Since your .pro file shows a lib project, I guess you mean you build the lib project successfully, but have errors in the app project.
    Your app project still need to add network module if it uses network APIs directly, even if it depends on the lib project that already added that.
    One possible situation is that although your app project doesn't use the QtNetwork functions, but it uses some header files from your lib project that includes <QNetworkReply>



  • Thank you everyone, I've solved, I changed to qt 5.14.2 and I've found the problem with a another variable, it had nothing to do with QNetworkReply


Log in to reply