First you need #include <QHostAddress>
, where it is assumed that the missing line is what caused the problem.
You can also check some project parameters to see if you have all the correct inputs.
Edit: Details
QtNetwork requires a QT network. Assuming once again that you are using QtCreator since no information was provided, this means that in your .pro file you need to have this line:
QT += network
Then make sure that you use the correct headers for the objects you are using before using them. If you still get undefined links, error binding, etc. Try QMake
and rebuild. If it still persists, you probably have errors in your code in addition to errors in using QT, and you should check that your methods and objects are declared correctly.
Final Edit: Glad it worked ...
When you create a new project in QTCreator, there is a step in the wizard where you can check out the various QT libraries that you want to include, which will add these .pro lines and inputs for you. This is the QT version for inputting additional lib files, and by default they will be statically linked, I suppose. If you want to dynamically communicate with shared objects or dlls, then there are additional configuration steps.
Ajg85 source share