Results 1 to 4 of 4

Thread: qpixelformat.h Error, Mac OS

  1. #1
    Join Date
    Jun 2019
    Posts
    2
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X

    Default qpixelformat.h Error, Mac OS

    Hi all,

    I'v been struggling for days with this issue.

    When ever I use "qpixelformat.h" header in my code, I get a bunch of error.
    I am using QT : 5.12.3 which was installed from homebrew.
    OS : Mac High Sierra 10.13.6
    Any advices? Please help.

    this is my error code :

    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:26: error: expected ')'
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:25: note: to match this '('
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:51: error: expected ')'
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:20: note: to match this '('
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:5: error: C++ requires a type specifier
    for all declarations
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:96:26: error: expected ')'
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:96:25: note: to match this '('
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:96:51: error: expected ')'
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:96:20: note: to match this '('
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:96:5: error: C++ requires a type specifier
    for all declarations
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == 8 * sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:98:76: error: expected ';' at end of
    declaration list
    Q_DECL_CONSTEXPR inline uchar get(Field offset, FieldWidth width) const Q_DECL_NOTHROW
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:163:43: error: expected ';' at end of
    declaration list
    Q_DECL_CONSTEXPR inline QPixelFormat() Q_DECL_NOTHROW : data(0) {}
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:178:29: error: unknown type name
    'ColorModel'
    Q_DECL_CONSTEXPR inline ColorModel colorModel() const Q_DECL_NOTHROW { return ColorModel(get...
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:178:58: error: expected ';' at end of
    declaration list
    Q_DECL_CONSTEXPR inline ColorModel colorModel() const Q_DECL_NOTHROW { return ColorModel(get...
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:225:12: error: unknown type name
    'Q_DECL_CONST_FUNCTION'
    friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(QPixelFormat fmt1, QPixe...
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:225:34: error: expected member name or ';'
    after declaration specifiers
    friend Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline bool operator==(QPixelFormat fmt1, QPixe...

    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:231:1: error: C++ requires a type specifier
    for all declarations
    Q_STATIC_ASSERT(sizeof(QPixelFormat) == sizeof(quint64));
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:236:68: error: 'YUVLayout' is a private
    member of 'QPixelFormat'
    QPixelFormat Q_GUI_EXPORT QPixelFormat_createYUV(QPixelFormat::YUVLayout yuvLayout,
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:138:10: note: implicitly declared private
    here
    enum YUVLayout {
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:238:68: error: 'AlphaUsage' is a private
    member of 'QPixelFormat'
    QPixelFormat::AlphaUsage alphaUsage,
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:116:10: note: implicitly declared private
    here
    enum AlphaUsage {
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:239:68: error: 'AlphaPosition' is a private
    member of 'QPixelFormat'
    QPixelFormat::AlphaPosition alphaPosition,
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:121:10: note: implicitly declared private
    here
    enum AlphaPosition {
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:240:68: error: 'AlphaPremultiplied' is a
    private member of 'QPixelFormat'
    QPixelFormat::AlphaPremultiplied premultiplied,
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:126:10: note: implicitly declared private
    here
    enum AlphaPremultiplied {
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:241:68: error: 'TypeInterpretation' is a
    private member of 'QPixelFormat'
    QPixelFormat::TypeInterpretation typeInterpretation,
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:131:10: note: implicitly declared private
    here
    enum TypeInterpretation {
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:242:68: error: 'ByteOrder' is a private
    member of 'QPixelFormat'
    QPixelFormat::ByteOrder byteOrder);
    ^
    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:157:10: note: implicitly declared private
    here
    enum ByteOrder {
    ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: qpixelformat.h Error, Mac OS

    Unless the Qt distribution on MacOS is different from other OS distributions, you should never use a Qt ".h" file directly. Instead, you should be including <QPixelFormat> (without the ".h"). This will ensure that any dependencies on other include files are resolved.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. The following user says thank you to d_stranz for this useful post:

    benjaminchou (26th June 2019)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qpixelformat.h Error, Mac OS

    Quote Originally Posted by d_stranz View Post
    Unless the Qt distribution on MacOS is different from other OS distributions, you should never use a Qt ".h" file directly. Instead, you should be including <QPixelFormat> (without the ".h").
    In most cases there should be no difference, one of them is usually simply including the other.

    The headers to avoid are "_p.h" ones, e.g. "qobject_p.h"
    The "_p" means it is a "private" header, used internally by Qt but not part of the public API.

    Quote Originally Posted by benjaminchou View Post
    Hi all,

    I'v been struggling for days with this issue.

    When ever I use "qpixelformat.h" header in my code, I get a bunch of error.
    I am using QT : 5.12.3 which was installed from homebrew.
    OS : Mac High Sierra 10.13.6
    Any advices? Please help.

    this is my error code :

    /usr/local/opt/qt/lib/QtGui.framework/Headers/qpixelformat.h:95:26: error: expected ')'
    Q_STATIC_ASSERT(uint(TotalFieldWidthByWidths) == uint(TotalFieldWidthByOffsets));
    ^
    Errors such as these often occur as a side effect of using headers from different APIs.

    E.g. one library can define something which is also defined in a different way in another, so depending on include order one usage might see the other's definition and have such a mismatch.

    Worst case is including headers two incompatible versions of the same library, e.g. including headers from a Qt4 based library and from a Qt5 based library.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    benjaminchou (26th June 2019)

  6. #4
    Join Date
    Jun 2019
    Posts
    2
    Thanks
    2
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: qpixelformat.h Error, Mac OS

    Thanks for the advices.

    I figured out the reason causing this issue:

    When building qt with homebrew, link needs to be done by hand with these commands:
    >brew link --overwrite --force qt
    >echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile

    Bests.

Similar Threads

  1. Buid error: collect2.exe: error: ld returned 1 exit status
    By Demonlaplce in forum Installation and Deployment
    Replies: 0
    Last Post: 21st April 2016, 10:18
  2. Replies: 3
    Last Post: 19th November 2014, 20:44
  3. Replies: 4
    Last Post: 29th April 2014, 17:20
  4. : error: [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\V ideo.exe] Error 1
    By ranjit.kadam in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st May 2011, 23:11
  5. Replies: 3
    Last Post: 23rd January 2011, 13:15

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.