在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度

由于前期创建qt程序的时候未勾选pch功能,导致没有启动预编译的功能.

这种情况下需要增加pch功能应该怎么做?

在项目中增加2个文件 stdafx.h和stdafx.cpp文件

stdafx.h增加qt常用头文件

#pragma once
//windows
#include 

//qt常用
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

 stdafx.cpp中只需要包含头文件即可,主要作用用来创建pch文件

#include "stdafx.h"

通过项目-属性-C/C++  按图设置 预编译头-改为使用, 头文件-stdafx.h

在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度_第1张图片

 高级- 按图添加  stdafx.h在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度_第2张图片

 选中stdafx.cpp文件-右键,将预编译头-改为创建.在VS-qt的程序中,后期增加PCH预编译功能,提高编译速度_第3张图片

你可能感兴趣的:(QT,qt,开发语言)