While compiling a collection of files in a Qt project, I'm seeing lots of warnings similar to this one.
In file included from /usr/local/Trolltech/Qt-4.8.6/include/QtGui/qevent.h:52:
/usr/local/Trolltech/Qt-4.8.6/include/QtGui/qmime.h:119:10: warning: private field 'type' is not used [-Wunused-private-field]
char type;
^
Per suggestions from various searches, I did add the entry
QMAKE_CXXFLAGS += -Wno-unused-private-field
to the .pro file and confirmed that it shows up properly in compiler invocations but I'm still getting that warning.
I'm running Qt on a Mac with clang.
Thanks in advance for any insights.
Per this answer, try
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field
It appears that the QMAKE_CXXFLAGS_WARN_ON
flags are added to the compiler command line after QMAKE_CXXFLAGS
, and would re-enable that warning (because QMAKE_CXXFLAGS
contains -Wall
).
It sounds strange that you can't compile due to Qt library. As I don't develop on Mac, what I would check is for supported Mac versions/compilers and how to compile on Mac. After that, if you fit requirements, I would report this as bug.
QT 4.8 Developing on Mac
[stackoverflow] How to build qt 5 project on mac
Another approach (as already reported in this QT-Bug: To #include generates warnings) is to include pragmas around warned headers.
#pragma GCC diagnostic ignored "-Wunused-private-field"
#include <QtGui>
#pragma GCC diagnostic warning "-Wunused-private-field"
First of all I am not sure on points its bug of QT or not but I found one recent question on QT forum about same. I hope it is solved.
Possible bug: qmime.h warning “char type is unused”
There is one more, Clang 4.2 warns about QMacMime unused private field "type"
This may help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With