I am using Qt’s QTcpSocket class to create a small chat client/server application. When I compile my code, the compiler returns the following error:
main.cpp:3:22: fatal error: QTcpSocket: No such file or directory
This refers to #include <QTcpSocket>.
Where is this library located and how can I install it?
After google it, we just need to add
QT += network
in the .pro file which is generated by
. Otherwise the module in which those headers are defined/libraries are built won’t be loaded.
NOTICE: If you use qmake -project after you modified .pro file, you will still get the above error. Because using qmake -project will change the .pro file back to before!
The commands I used is described in my article:
qmake -project qmake -tp vc
The problem described above is solved. Just keep in mind that qmake -project is used to generate .pro file and qmake -tp vc is used to generate Visual Studio project file.
Copyright © 2012, The Big Bang on Reading Busy. All rights reserved.
On republishing this post you must provide link to the original post.
Hello would you mind sharing which blog platform you’re using?
I’m looking to start my own blog soon but I’m having a hard time selecting
between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is
because your design and style seems different then most blogs and I’m looking for something unique.
P.S Apologies for getting off-topic but I had to ask!