Solved Cannot open include file: 'QtNetwork': No such file or directory
-
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.
-
add
QT += network
to your .pro file
-
for example, it works in this way
"#include <QtNetwork\QTcpsocket>" -
I do not know why my VS can not open some Qt modules, for example:
#include <QtGui> // no error
#include <Qt3DCore> error
????? -
-
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.
-
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
-
problem solved. this link https://doc.qt.io/qtvstools/qtvstools-managing-projects.html solved my problem. thanks