Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error: C++ requires a type specifier for all declarations
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 13.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nicky j
    wrote on last edited by
    #1

    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.

    Thanks!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nicky j
        wrote on last edited by
        #3

        indeed it is, how careless of me :P

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved