Unsolved QUdpSocket failed when make while QTcpSocket is fine in
-
I am working on an embedded linux 3.5.0-25 with qt-everywhere-opensource-src-4.6.3
I have the dialog.h as:
........
#include <QtNetwork>
#include <QTcpSocket>
#include <QUdpSocket>
.......
QTcpSocket *pSocketTcp;
QUdpSocket *pSocketUdp;
.......
That will get error:error: ISO C++ forbids declaration of `QUdpSocket' with no type
When I remarked QUdpSocket *pSocketUdp; line and keep the QTcpSocket *pSocketTcp; there, the make worked fine.
I need help to make QUdpSocket work in my application.
Thanks in advance. -
@Quey But the compiler does not complain about #include <QUdpSocket> ?
-
@jsulm said in QUdpSocket failed when make while QTcpSocket is fine in:
But the compiler does not complain about #include <QUdpSocket> ?
It will compile fine as long as there is no variable QUdpSocket *pSocket;
-
@Quey Just realised you're working with Qt 4.6.3 which very old (not even latest Qt 4 release).
I suggest to check the content of the QUdpSocket header file.
Also you can post the real code where this error message originates from. Can be that there is something wrong in another place than the "QUdpSocket *pSocketUdp;" line. Because the error suggests that you're actually trying to declare a variable named QUdpSocket. -
Thanks, I'll do some works for a much clear picture.
-
@jsulm Thanks, it turned out that the QUdpSocket header file has directive as
#ifndef QT_NO_UDPSOCKETremark this #if solves my problem, thanks.