Results 1 to 6 of 6

Thread: Strange Errors while compiling (QT Header Files)

  1. #1
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Strange Errors while compiling (QT Header Files)

    Hi all,

    So, I'm busy with this pretty large project and I've come across a strange error today.

    The code I'm working on is seperated over about 20 different files, and it used to compile with some warnings (The code is not completely finished yet) but this very file that produces this error used to compile fine without any errors or warnings.

    Yet somehow it suddenly produces errors like this:

    Qt Code:
    1. In file included from ../Qt/4.4.3/include/QtCore/qnamespace.h:1,
    2. from ../Qt/4.4.3/include/QtCore/../../src/corelib/kernel/qobjec
    3. tdefs.h:41,
    4. from ../Qt/4.4.3/include/QtCore/qobjectdefs.h:1,
    5. from ../Qt/4.4.3/include/QtCore/../../src/corelib/kernel/qobjec
    6. t.h:43,
    7. from ../Qt/4.4.3/include/QtCore/qobject.h:1,
    8. from ../Qt/4.4.3/include/QtCore/QObject:1,
    9. from ReferenceStructureForm.h:2:
    10. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:50: error: synt
    11. ax error before "namespace"
    12. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:54: error: synt
    13. ax error before '{' token
    14. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:121: warning: r
    15. eturn type defaults to `int'
    16. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h: In function `Q
    17. _DECLARE_FLAGS':
    18. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: `Qt
    19. ' undeclared (first use in this function)
    20. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: (Ea
    21. ch undeclared identifier is reported only once
    22. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: error: for
    23. each function it appears in.)
    24. ../Qt/4.4.3/include/QtCore/../../src/corelib/global/qnamespace.h:122: confused b
    25. y earlier errors, bailing out
    26. mingw32-make[1]: *** [release/ReferenceStructureForm.o] Error 1
    27. mingw32-make[1]: Leaving directory `C:/TMP'
    28. mingw32-make: *** [release] Error 2
    To copy to clipboard, switch view to plain text mode 

    The code that I'm trying to compile goes like this:

    Header file:
    Qt Code:
    1. #include <QObject>
    2.  
    3. #ifndef ReferenceStructureFormH
    4. #define ReferenceStructureFormH
    5.  
    6. class QFormReferenceStructure : public QObject
    7. {
    8. Q_OBJECT
    9. public:
    10. QFormReferenceStructure(QViewerList *parent = 0);
    11. bool DoShowReferenceStructureFile(QString);
    12.  
    13.  
    14. };
    15.  
    16. #endif
    To copy to clipboard, switch view to plain text mode 

    And the .cpp file:

    Qt Code:
    1. #include "ReferenceStructureForm.h"
    2.  
    3. QFormReferenceStructure::QFormReferenceStructure(QViewerList *parent)
    4. :QObject(parent)
    5. {
    6. }
    7.  
    8. bool QFormReferenceStructure::DoShowReferenceStructureFile(QString FileName)
    9. {
    10. return true;
    11. }
    To copy to clipboard, switch view to plain text mode 

    The functions aren't realy doing anything yet, this was just for testing.

    There are some threads about similar errors on the QTForum, but for answers they provided links to threads that no longer seem to exist.

    Can anyone help me?

    Thanks in advance!

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Strange Errors while compiling (QT Header Files)

    could you try putting the header guard before #include <QObject>

  3. #3
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Strange Errors while compiling (QT Header Files)

    Thanks for the reply.

    I tried, but no luck...

    It has to be something else I guess.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Strange Errors while compiling (QT Header Files)

    What's QViewerList? There may be the problem while casting to a QObject for the ctor of the base class. And better put the #include* inside the def.

    EDIT: And it is confusing if you are naming your own classes like Qt. So you might want choose another letter to start you class names.

  5. #5
    Join Date
    May 2009
    Posts
    61
    Thanks
    5
    Thanked 6 Times in 6 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Strange Errors while compiling (QT Header Files)

    Quote Originally Posted by Lykurg View Post
    There may be the problem while casting to a QObject for the ctor of the base class.
    That would not result in a syntax error, would it? Sounds more like a missing ";" at the end of a class or something like that.
    Last edited by auba; 20th May 2009 at 23:19.

  6. #6
    Join Date
    May 2008
    Posts
    61
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Strange Errors while compiling (QT Header Files)

    can you post the .pro file contents ?

Similar Threads

  1. C++ Compiling Errors when use Visual Studio 6.0
    By seguprasad in forum General Programming
    Replies: 1
    Last Post: 3rd February 2009, 12:47
  2. A good system on header files
    By baray98 in forum General Programming
    Replies: 3
    Last Post: 23rd January 2009, 00:17
  3. compiling problem / Qt DLL files
    By ht1 in forum Newbie
    Replies: 1
    Last Post: 5th January 2008, 18:58
  4. qt3 themes example: missing header files?
    By nikita in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2006, 13:12
  5. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 11:28

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.