There is a class:

#include <QObject> #include <QUdpSocket> class MyUDP : public QObject { Q_OBJECT public: explicit MyUDP(QObject *parent = 0); public slots: void read(); private: QUdpSocket *socket; }; 

But the compiler produces an error:

error: 'slots' does not name a type

What could be the reason?

  • one
    In the above code, everything is clean. Perhaps somewhere else, the slots redefined as a variable or something else. - user194374
  • No, slots is not overridden. - Logotipo
  • @Logotipo please describe the sequence of steps that reproduces the indicated error. minimum reproducible example - αλεχολυτ

1 answer 1

Replaced

 public slots: 

on

 public Q_SLOTS: 

Perhaps this is due to the fact that I use boost. Although no boost files were included in the files with this class.

  • The project does not specify the directive CONFIG += no_keywords ? doc.qt.io/qt-4.8/… - ߊߚߤߘ
  • @Arhad, listed - Logotipo
  • 2
    Here, she cancels the declaration of the macro slots and signals . - ию