由于前期创建qt程序的时候未勾选pch功能,导致没有启动预编译的功能.
这种情况下需要增加pch功能应该怎么做?
在项目中增加2个文件 stdafx.h和stdafx.cpp文件
stdafx.h增加qt常用头文件
#pragma once
//windows
#include <windows.h>//qt常用
#include <QObject>
#include <QDebug>
#include <QtWidgets>
#include <QString>
#include <QList>
#include <QVector>
#include <QMap>
#include <QMutex>
#include <QQueue>
#include <QThread>
#include <QTimer>
#include <QtWidgets>
#include <QThread>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QProcess>
#include <QWindow>
#include <QSharedMemory>
stdafx.cpp中只需要包含头文件即可,主要作用用来创建pch文件
#include "stdafx.h"
通过项目-属性-C/C++ 按图设置 预编译头-改为使用, 头文件-stdafx.h
高级- 按图添加 stdafx.h
选中stdafx.cpp文件-右键,将预编译头-改为创建.