Important: Please read the Qt Code of Conduct -

Error: C++ requires a type specifier for all declarations

  • Hello!

    I have been trying to create a new class and I keep getting this error: C++ requires a type specifier for all declarations.

    I'm not sure really what it wants. Here is the code:
    NBhistoryItem::NBhistoryItemN(QString hUrl, QString hTitle)
    QString url = hUrl;
    QString title = hTitle;

    The error appears to be on line 1.


  • The function NBhistoryItemN() has to have a return type (or void). Only the constructor and destructor have no return type.

    This looks like a typo.

  • indeed it is, how careless of me :P

Log in to reply