• 5508阅读
  • 2回复

qt udp编程 问题 [复制链接]

上一主题 下一主题
离线phoenixxz
 

只看楼主 正序阅读 楼主  发表于: 2011-05-31
#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
离线luoyang

只看该作者 2楼 发表于: 2011-05-31
在.pro中加入QT += network
离线sy1413

只看该作者 1楼 发表于: 2011-05-31
在.pro中加入QT += network
hello world!
快速回复
限100 字节
 
上一个 下一个