Results 1 to 13 of 13

Thread: what does this mean " error: ISO C++ forbids declaration of --- with no type?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    actually it is sampleThread only

  2. #2
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    Quote Originally Posted by qtlinuxnewbie View Post
    actually it is sampleThread only
    ??? Pardon? I don't understand.

    It is either:
    QThread *newThread;
    or:
    sampleThread *newThread;

    You don't have a class 'Thread'.

  3. #3
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    may be i was not clear for u .
    it is
    Qt Code:
    1. sampleThread *newThread
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    In the code you have posted, you use just "Thread", not "sampleThread".

  5. #5
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    i changed the posted code to sampleThread and tried to build but i am getting the same error.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: what does this mean " error: ISO C++ forbids declaration of --- with no type?

    You have a loop in your includes - mainwindow.h includes sampleThread.h which again includes mainwindow.h. Use a forward declaration in mainwindow.h instead of including sampleThread.h or don't include mainwindow.h in the other file.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 27th August 2011, 12:59
  2. forbids declaration of QHash with no type
    By nina1983 in forum Qt Programming
    Replies: 4
    Last Post: 16th July 2008, 13:05
  3. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 11:45
  4. Compilation error: "field 'xxx' has incomplete type"
    By fedcer in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 15:01
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.