在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度
- 游戏开发
- 2025-08-29 13:36:02

由于前期创建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文件-右键,将预编译头-改为创建.
在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度由讯客互联游戏开发栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度”