Results 1 to 12 of 12

Thread: Apparent error in QtCore/quuid.h

  1. #1
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Apparent error in QtCore/quuid.h

    Hi,
    I've been working on an application in Qt 3.3 and I've just upgraded to 4.4. When I now make my app I get the following error message:
    Qt Code:
    1. make -fMakefile.multi_meter.unx
    2. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.4.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.4.3/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.4.3/include -I../../libbaptools/src -I/usr/X11R6/include -I. -I. -o obj_unix/meterwindow.o meterwindow.cpp
    3. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: expected `)' before ‘-’ token
    4. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: expected ‘,’ or ‘...’ before ‘-’ token
    5. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: expected identifier before numeric constant
    6. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: expected ‘,’ or ‘...’ before numeric constant
    7. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: ISO C++ forbids declaration of ‘uchar’ with no type
    8. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: declaration of ‘int QUuid::uchar(int)’
    9. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/qglobal.h:788: error: changes meaning of ‘uchar’ from ‘typedef unsigned char uchar’
    10. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: ISO C++ forbids declaration of ‘uchar’ with no type
    11. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:89: error: expected ‘;’ before ‘b3’
    12. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:104: error: expected `;' before ‘QUuid’
    13. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:174: error: ‘uchar’ does not name a type
    14. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h: In constructor ‘QUuid::QUuid()’:
    15. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:87: error: ‘data4’ was not declared in this scope
    16. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h: In member function ‘bool QUuid::operator==(const QUuid&) const’:
    17. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:119: error: ‘data4’ was not declared in this scope
    18. /usr/local/Trolltech/Qt-4.4.3/include/QtCore/quuid.h:119: error: ‘const struct QUuid’ has no member named ‘data4’
    19. make: *** [obj_unix/meterwindow.o] Error 1
    To copy to clipboard, switch view to plain text mode 

    I'm guessing there's some incompatibility between my code and Qt4.4 but it still seem an odd set of error messages. Does anyone have any ideas what the problem is from these messages?
    Thanks
    Chris

  2. #2
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Apparent error in QtCore/quuid.h

    Oh and I'm running it on openSUSE 10.2 and Mac OSX 10.4. I get the same issues on both.

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

    Default Re: Apparent error in QtCore/quuid.h

    What's the contents of your qmake project file? Could you also try reordering include statements so that Qt includes come first? Such errors are often results of some namespace clash.

  4. The following user says thank you to wysota for this useful post:

    cwp500 (18th December 2008)

  5. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Apparent error in QtCore/quuid.h

    The error is in all probability some macro (preprocessor) that is not as you expect.
    Use the -E switch to get the g++ output after preprocessing. Locate the line causing the error and you should be able to trace the real cause of the issue.

    HTH

  6. The following user says thank you to caduel for this useful post:

    cwp500 (18th December 2008)

  7. #5
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Apparent error in QtCore/quuid.h

    cheers, i've tried switching round the includes before but it doesn't seem to do anything

    Qt Code:
    1. #include <QObject>
    2. #include <QString>
    3. #include <QMessageBox>
    4. #include <QGLFormat>
    5. #include "meterwindow.h"
    6. #include "portaudio.h"
    7. #include <iostream>
    8. using namespace std;
    To copy to clipboard, switch view to plain text mode 

    this is the qmake .pro file
    QMake Code:
    1. TARGET = multi_meter
    2.  
    3. #CONFIG += debug
    4. QT += opengl
    5.  
    6. include (portaudio.pri)
    7. include (libbaptools.pri)
    8. include (baptools.pri)
    9.  
    10.  
    11.  
    12. HEADERS += meterwindow.h \
    13. qt_bendyloudness.h \
    14. device_setup_widget.h \
    15. config_widget.h \
    16. device_list.h \
    17. device.h \
    18. signal_monitor.h \
    19. mode_sel_but.h \
    20. input_sel_but.h \
    21. sampledrop.h
    22.  
    23.  
    24. SOURCES += multichan_meter.cpp \
    25. meterwindow.cpp \
    26. qt_bendyloudness.cpp \
    27. device_setup_widget.cpp \
    28. config_widget.cpp \
    29. device_list.cpp \
    30. device.cpp \
    31. signal_monitor.cpp \
    32. mode_sel_but.cpp \
    33. input_sel_but.cpp\
    34. sampledrop.cpp
    To copy to clipboard, switch view to plain text mode 

    this is the included baptools.pri which is the only one of those three files that contains any QT stuff.

    QMake Code:
    1. TEMPLATE = app
    2. CONFIG += qt warn_on rtti
    3.  
    4. #
    5. # set Makefile and include directories
    6. #
    7. macx {
    8. MAKEFILE = Makefile.$${TARGET}.osx
    9. QMAKE_MACOSX_DEPLOYMENT_TARGET=10.3
    10. # To avoid weak symbol mismatch errors when building with static libraries
    11. message( Adding linker flag "-weak_reference_mismatches non-weak")
    12. QMAKE_LFLAGS += -weak_reference_mismatches non-weak
    13. } else {
    14. unix {
    15. MAKEFILE = Makefile.$${TARGET}.unx
    16. }
    17. win32 {
    18. MAKEFILE = Makefile.$${TARGET}.win
    19. }
    20. }
    21.  
    22. unix: OBJECTS_DIR = ./obj_unix/
    23. macx: OBJECTS_DIR = ./obj_macx/
    24. win32: OBJECTS_DIR = .\\obj_win32
    25.  
    26. # optional static linking settings, invoked using 'qmake "CONFIG+=static_config" ...'
    27. include(static_config.pri)
    To copy to clipboard, switch view to plain text mode 
    thanks for your help
    Last edited by wysota; 2nd January 2009 at 23:14. Reason: Changed [code] to [highlight]

  8. #6
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Apparent error in QtCore/quuid.h

    cheers caduel.
    could you help me decipher this?
    [CODE]
    g++ -headerpad_max_install_names -weak_reference_mismatches non-weak -o multi_meter.app/Contents/MacOS/multi_meter obj_macx/loud.o obj_macx/multichan_meter.o obj_macx/meterwindow.o obj_macx/qt_bendyloudness.o obj_macx/device_setup_widget.o obj_macx/config_widget.o obj_macx/device_list.o obj_macx/device.o obj_macx/signal_monitor.o obj_macx/mode_sel_but.o obj_macx/input_sel_but.o obj_macx/sampledrop.o obj_macx/moc_meterwindow.o obj_macx/moc_qt_bendyloudness.o obj_macx/moc_device_setup_widget.o obj_macx/moc_config_widget.o obj_macx/moc_device_list.o obj_macx/moc_device.o obj_macx/moc_signal_monitor.o obj_macx/moc_mode_sel_but.o obj_macx/moc_input_sel_but.o obj_macx/moc_sampledrop.o -F/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/local/Trolltech/Qt-4.4.3/lib -framework CoreAudio -framework AudioToolbox -framework QtOpenGL -L/usr/local/Trolltech/Qt-4.4.3/lib -F/usr/local/Trolltech/Qt-4.4.3/lib -framework QtGui -framework Carbon -framework AppKit -framework QtCore -lz -lm -framework ApplicationServices -framework OpenGL -framework AGL
    /usr/bin/ld: obj_macx/multichan_meter.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/meterwindow.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/qt_bendyloudness.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/device_setup_widget.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/config_widget.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/device_list.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/device.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/signal_monitor.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/mode_sel_but.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/input_sel_but.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/sampledrop.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_meterwindow.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_qt_bendyloudness.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_device_setup_widget.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_config_widget.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_device_list.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_device.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_signal_monitor.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_mode_sel_but.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_input_sel_but.o bad magic number (not a Mach-O file)
    /usr/bin/ld: obj_macx/moc_sampledrop.o bad magic number (not a Mach-O file)
    collect2: ld returned 1 exit status
    make: *** [multi_meter.app/Contents/MacOS/multi_meter] Error 1

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

    Default Re: Apparent error in QtCore/quuid.h

    Could you check the contents of the offending line? I mean the 89th line of the file mentioned by the compiler. My version doesn't have any "-" characters in that line. I'd say the conflict is in the "uchar" symbol which Qt defines as a typedef to unsigned char. Do you declare such symbol somewhere?

  10. The following user says thank you to wysota for this useful post:

    cwp500 (18th December 2008)

  11. #8
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Apparent error in QtCore/quuid.h

    please take the compile statement
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.4.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtCore -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtGui -I/usr/local/Trolltech/Qt-4.4.3/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.4.3/include/QtOpenGL -I/usr/local/Trolltech/Qt-4.4.3/include -I../../libbaptools/src -I/usr/X11R6/include -I. -I. -o obj_unix/meterwindow.o meterwindow.cpp
    replace the -c by -E
    and -o obj_unix/meterwindow.o by -o /tmp/to_check

    Then find the line "89" in quuid.h in that file. There will be some error. The error will be that something has been broken by some (unexceptedly) defined macro, e.g.
    a #define uchar "some bogus text".
    If you can not decipher the contents, show it to us.

  12. #9
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Apparent error in QtCore/quuid.h

    Hi,
    I've been trying to sort it out but no luck.
    Line 89 looks fine in quuid.h
    Qt Code:
    1. enum Version {
    2. VerUnknown =-1,
    3. Time = 1, // 0 0 0 1
    4. EmbeddedPOSIX = 2, // 0 0 1 0
    5. Name = 3, // 0 0 1 1
    6. Random = 4 // 0 1 0 0
    7. };
    8.  
    9. {
    10. data1 = 0;
    11. data2 = 0;
    12. data3 = 0;
    13. for(int i = 0; i < 8; i++)
    14. data4[i] = 0;
    15. }
    16. QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) // this is line 89
    17. {
    18. data1 = l;
    19. data2 = w1;
    20. data3 = w2;
    21. data4[0] = b1;
    22. data4[1] = b2;
    23. data4[2] = b3;
    24. data4[3] = b4;
    25. data4[4] = b5;
    26. data4[5] = b6;
    27. data4[6] = b7;
    28. data4[7] = b8;
    29. }
    30. #ifndef QT_NO_QUUID_STRING
    To copy to clipboard, switch view to plain text mode 
    as does the code around it.

    When I run the compile command with the -E flag, there is no error and the output file contains 70000 lines. i don't know how to begin with it. that's on openSUSE. on my mac it seems to have failed to find any of the Qt header files even though their directories are linked in the g++ command.
    sorry this doesn't give you much but do you have any other suggestions?
    Last edited by cwp500; 18th December 2008 at 16:06.

  13. #10
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Apparent error in QtCore/quuid.h

    you have to search in that 70000 lines of code (which are what the compiler has to digest once the preprocessor is done) for your line...

    you can do that in three ways:
    1) just try to compile that file
    2) use the file/line info (quuid.h, 89) to find that line in that (big) file.
    Look for lines like
    Qt Code:
    1. # 5 "path_to_your_qt_includes/quuid.h" 2
    To copy to clipboard, switch view to plain text mode 
    this means: this line correspondends to line 5 in the file quuid.h; if no more file should be included, go 84 lines further and you have found that spot
    3) look into quuid.h, close to line 89; find some probably "unique" code (no macros!) and just search the big file for it
    [4) post the file here as attachment... we will find out]

    HTH

  14. The following user says thank you to caduel for this useful post:

    cwp500 (18th December 2008)

  15. #11
    Join Date
    Dec 2008
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Apparent error in QtCore/quuid.h

    I found the offending item. In one of my code files I had included <QtOpenGL> as in one of the example files. When I changed this for the specific classes I need it worked fine.
    Thanks for the help guys.

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

    Default Re: Apparent error in QtCore/quuid.h

    It shouldn't have caused you problems...

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.