Cannot open include file: 'QtNetwork': No such file or directory
-
wrote on 6 May 2020, 05:00 last edited by
I use vs 2017 c++. I can use qt without any problem, but when I include QtNetwork, i get an error ???
#include <QtCore> // work
#include <QtNetwork> //not work ??second #include does not work ?
both of then are in the same folder.
-
wrote on 6 May 2020, 05:03 last edited by
add
QT += network
to your .pro file
-
wrote on 6 May 2020, 05:13 last edited by
for example, it works in this way
"#include <QtNetwork\QTcpsocket>" -
wrote on 6 May 2020, 07:11 last edited by
I do not know why my VS can not open some Qt modules, for example:
#include <QtGui> // no error
#include <Qt3DCore> error
????? -
I do not know why my VS can not open some Qt modules, for example:
#include <QtGui> // no error
#include <Qt3DCore> error
????? -
wrote on 6 May 2020, 07:25 last edited by
where is this file?
-
@Aminmlp Well, since you're using Visual Studio and not QtCreator you have to check how it is done in Visua Studio. I don't use Visual Studio but it looks like it is in "Qt Modules" tab - see https://doc.qt.io/qtvstools/qtvstools-managing-projects.html
Background: Qt is modular, that's why you need explicitly activate modules you want to use. This way you can reduce dependencies of your app.
-
wrote on 6 May 2020, 07:41 last edited by
I find the .pro file and add QT+= 3dcore but does not work
-
@Aminmlp After editing pro file you need to run qmake and rebuild
-
wrote on 6 May 2020, 10:09 last edited by
problem solved. this link https://doc.qt.io/qtvstools/qtvstools-managing-projects.html solved my problem. thanks
5/10