Qt中增加预编译以提高程序的编译速度

具体设置步骤如下

(1)工程.pro文件加入下面代码

CONFIG+=precompile_header  
PRECOMPILED_HEADER=precompile.h  

(2)再建立头文件precompile.h,代码内容为

#ifndef STABLE_H
#define STABLE_H

#include<QtCore>
#include<QtGui>

#endif // STABLE_H

(3)重新构建文件

编译速度加快了很多,这样处理之后,会生成.pch\C++文件大约165M的预编译头。

注意:precompile.h中头文件可按需添加,原则:添加各个头文件中重复包含较多的公用头文件;如precompile.h中包含头文件有内容修改,需重新构建。

猜你喜欢

转载自blog.csdn.net/oTianLe1234/article/details/115032141