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.
-
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 ?
-
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 -
@Achille15 Please show us your .pro-file
-
@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 ? -
@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" -
Please post your pro-file.
-
@Christian-Ehrlicher
#-------------------------------------------------Project created by QtCreator 2019-12-29T19:35:37
#-------------------------------------------------
QT -= gui
QT += sql networkTARGET = cm-lib
TEMPLATE = libCONFIG += 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.cppHEADERS +=
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.hinclude(../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/.uiunix {
target.path = /usr/lib
INSTALLS += target
} -
@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" ?
-
@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>