Search code examples
c++qtserverclient-serverqtcpserver

Type qintptr not found in Qt5.4.1


I'm working with Qt5.4.1, and implementing a server-client application. In the QTcpServer class the method:

void incomingConnection(int socketDescriptor); 

has integer type for the socketDescriptor, but for Qt5.5, this method has changed and has the following declaration:

void incomingConnection (qintptr socketDescriptor);

The problem is that my compiler does not find the typedef qintptr. The error message is that qintptr has not been declared.

I have added the header file

#include <QtGlobal>

but the compiler still doesn't find this type.

When I change the qintptr to quintptr, the compiler finds it, but this type gives type mismatch error. How can I solve this problem?


Solution

  • The problem is that the project was opened in qt5, but still has some references to the old version of qt (4.8.x). Therefore it was looking for qtptr in the path /usr/include/QtCore/qglobal.h. I have changed the path to /opt/Qt5.../QtCore/qglobal.h and the problem is solved