recently I found that I can make my compilation faster using PCH file, so decided to go on it, prepared suitable _pch.h header file when I put all includes I use in my whole project and I keep repeating the same includes in many header files (I assume this is one of the additional-feature of pch.h, make me correct, if I'm wrong). I also modified my *.pro file (basing on docs), below is the snippet from it
CONFIG += precompile_header
PRECOMPILED_HEADER = _pch.h ####it is a precompiled headear file
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
DEFINES += USING_PCH
}
CONFIG += precompile_header
PRECOMPILED_HEADER = _pch.h ####it is a precompiled headear file
precompile_header:!isEmpty(PRECOMPILED_HEADER) {
DEFINES += USING_PCH
}
To copy to clipboard, switch view to plain text mode
and here is _pch.h
#ifndef _PCH_H
#define _PCH_H
#if defined __cplusplus
#include <QtCore>
#include <QtGui>
#include <QDebug>
#include <QList>
#include <QPointer>
#include <QObject>
#include <QString>
#endif
#endif // _PCH_H
#ifndef _PCH_H
#define _PCH_H
#if defined __cplusplus
#include <QtCore>
#include <QtGui>
#include <QDebug>
#include <QList>
#include <QPointer>
#include <QObject>
#include <QString>
#endif
#endif // _PCH_H
To copy to clipboard, switch view to plain text mode
and from now on it works pretty well, nevertheless in some headers (not all) I have a warning from QtCreator that for example QString or QPointer is not a type name, where in other headers this warning is not produced
it is both very interesting that in some files there is no warning and very annoying because underlined lines of code are like red rag though it does not affect on compilation process
perhaps I did something wrong or assumed something which in obvious way is a mistake and my code is a time bomb from now on ?
Bookmarks