Search code examples
c++qtqtnetwork

Include QNetwork module


First, I've seen this thread : How to use/include the QtNetwork Module. I've followed every step. these are my includes :

#include <QTcpServer>
#include <QTcpSocket>

My additionnal include directory path

C:\Qt\5.15.1\msvc2019_64\include\QtNetwork

My additional library path

C:\Qt\5.15.1\msvc2019_64\lib;

Right now it compiles with just the includes, but the simple line of code :

QTcpSocket* pTcpSocket = new QTcpSocket();

creates unresolved externals error. Now I get that this is due to the linker failure to find the right lib. But if, such as what was done in the other thread, i try to add this dependency :

QtNetwork.lib

The compiler will complain that it cannot find this file "QtNetwork.lib". Indeed, this file isn't in my "C:\Qt\5.15.1\msvc2019_64\lib;" folder. On QtCreator it was piece of cake to get this to run, simply add "QT += network" to the .pro file, run qmake and work done. However I am stuck on trying to get this to run on msvc with QT extension tool, any ideas ?


Solution

  • Ok I've found the problem, it stems from the fact the lib file is currently named "Qt5Networkd.lib" and not "QtNetworkd.lib" as i had seen on the web. Leaving the answer here in case someone goes across the same trouble.