PDA

View Full Version : HELP! #warning "Inclusion of header files from include/Qt is deprecated."



yuzhouzhiwai
28th April 2012, 03:54
hello,
I upgrade my qt from 4.3 to 4.7. And I found many files in the directory "include/Qt/*" increase some code like this:


#ifndef QT_NO_QT_INCLUDE_WARN
#if defined(__GNUC__)
#warning "Inclusion of header files from include/Qt is deprecated."
#elif defined(_MSC_VER)
#pragma message("WARNING: Inclusion of header files from include/Qt is deprecated.")
#endif
#endif


That means, if I want to avoid the warning message , I must define the micro "QT_NO_QT_INCLUDE_WARN" ? But what is the meaning of warning message ?

thanks

ChrisW67
28th April 2012, 04:53
No, it means you should fix your source code to not use the deprecated include files and start using the documented include files. For example,


#include "Qt/qwidget.h"
// should be
#include <QWidget> // this is what typically appears in the documentation and examples
// or even
#include <QtGui/QWidget> // this appears from time to time in examples
#include <QtGui/qwidget.h> // and even this

In the meantime you can suppress the warning by defining QT_NO_QT_INCLUDE_WARN, but you will still have to fix your source before the deprecated includes disappear.

BTW: I only see those warnings in the Qt 4.8 source, not Qt 4.7