简体   繁体   中英

error: no operator found which takes a right-hand QUdpSocket

Hello I use QT for developing I have this c++ code:

#include "udp.h"

udp::udp(QObject *parent) : QObject(parent)
{
   socket=new QUdpSocket(this);
   socket-> bind(QHostAddress::LocalHost,12345);
   connect(socket,SIGNAL(Readyread()),this ,SLOT(Readyread()));
}

This is example I just got from internet . well i get an error says:

error: C2679: binary '=' : no operator found which takes a right-hand operand of type 'QUdpSocket *' (or there is no acceptable conversion)

Please guide me how can I solve this error.

socket应声明为QUdpSocket* ,而不是QUdpSocket

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM