#include<QDialog>
#include<QtCore>
#include<QtNetwork/QAbstractSocket>
#include<QtNetwork/QUdpSocket>
#include<QtNetwork/QHostAddress>
在构造函数中
udpSocket = new QUdpSocket(this);
udpSocket->bind(44444);
但是编译总是出错。
dialog.o: In function `Dialog::Dialog()':
dialog.cpp:(.text+0x170f): undefined reference to `QUdpSocket::QUdpSocket(QObject*)'
dialog.cpp:(.text+0x1725): undefined reference to `QUdpSocket::bind(unsigned short)'
dialog.o: In function `Dialog::Dialog()':
dialog.cpp:(.text+0x194f): undefined reference to `QUdpSocket::QUdpSocket(QObject*)'
dialog.cpp:(.text+0x1965): undefined reference to `QUdpSocket::bind(unsigned short)'
collect2: ld returned 1 exit status不知道是什么问题,我用的是qt4