PDA

View Full Version : qpixelformat.h Error, Mac OS



benjaminchou
21st June 2019, 12:25
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=]

d_stranz
21st June 2019, 17:21
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.

anda_skoa
22nd June 2019, 08:33
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.


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,
_

benjaminchou
26th June 2019, 08:47
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.