Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Qt - QTcpSocket - File not found

Tags:

c++

qt

qtcpsocket

I am using Qt and QTcpSocket 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?

like image 471
Béatrice Moissinac Avatar asked Nov 05 '12 04:11

Béatrice Moissinac


1 Answers

You need

QT += network

in your .pro file. Otherwise the module in which those headers are defined/libraries are built won't be loaded.

like image 109
Matt Phillips Avatar answered Oct 30 '22 01:10

Matt Phillips