`

为什么要加#include "stdafx.h"

阅读更多

所谓头文件预编译,就是把一个工程(Project)中使用的一些MFC标准头文件(如Windows.H、Afxwin.H)预先编译,以后该工程编译时,不再编译这部分头文件,仅仅使用预编译的结果。这样可以加快编译速度,节省时间。

预编译头文件通过编译stdafx.cpp生成,以工程名命名,由于预编译的头文件的后缀是“pch”,所以编译结果文件是projectname.pch。

编译器通过一个头文件stdafx.h来使用预编译头文件。stdafx.h这个头文件名是可以在project的编译设置里指定的。编译器认为,所有在指令#include "stdafx.h"前的代码都是预编译的,它跳过#include "stdafx. h"指令,使用projectname.pch编译这条指令之后的所有代码。

因此,所有的CPP实现文件第一条语句都是:#include "stdafx.h"。

分享到:
评论

相关推荐

    头文件下载

    编译器认为,所有在指令#include "stdafx.h"前的代码都是预编译的,它跳过#include "stdafx. h"指令,使用projectname.pch编译这条指令之后的所有代码。 因此,所有的MFC实现文件第一条语句都是:#include "stdafx.h...

    头文件免费下载

    // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__C4B5DA9B_21...

    StdAfx.h头文件下载,编程必备!

    编译器认为,所有在指令#include "stdafx.h"前的代码都是预编译的,它跳过#include "stdafx. h"指令,使用projectname.pch编译这条指令之后的所有代码。 因此,所有的MFC实现文件第一条语句都是:#include "stdafx.h...

    StdAfx.rar_ stdafx.h_stdafx_stdafx.h_stdafx.h 头文件

    StdAfx.h vc++重要的头文件的 要放到vc98/include文件夹里面

    stdafx.h文件

    stdafx.h并不是标准C++头文件,与项目的源代码文件存放在同一个文件文件夹下,通过#include"stdafx.h"引用。stdafx的英文全称为:Standard Application Framework Extensions(标准应用程序框架的扩展)

    stdafx.h的作用

    stdafx.h的作用 最近经常用到这个头文件,所以就到网上看也一下,大家也看看吧。

    抓包程序源代码java格式

    //#include"stdafx.h" #include"winsock2.h" #include"ws2tcpip.h" #include"stdio.h" //#include"iostream.h

    为什么要知道.rar加#include stdafx_h_百度

    为什么要加#include stdfx——h

    stdafx_h头文件

    编译器认为,所有在指令#include "stdafx.h"前的代码都是预编译的,它跳过#include "stdafx. h"指令,使用projectname.pch编译这条指令之后的所有代码。 因此,所有的MFC实现文件第一条语句都是:#include "stdafx.h...

    stdafx.h头文件

    stdafx.h头文件下载,在VC++6.0中有时会发现没有这个文件,可以将些下载下来放到需要的工程文件当中

    使用C语言编写圣诞表白程序

    快到圣诞节啦,男票女票都有了嘛?...#include stdafx.h #include GreetingCardDemo.h #include GreetingCardDemoDlg.h #include afxdialogex.h #ifdef _DEBUG #define new DEBUG_NEW #endif // 用

    Http协议源码

    #include "stdafx.h" #include "HTTPClient.h" #include "MainFrm.h" #include "HTTPClientDoc.h" #include "HTTPClientView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] =...

    stdafx.h代码

    stdafx.h的代码// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) 1992-1998 Microsoft Corporation // All rights reserved. // // This source code is only intended as a ...

    基于VC中使用ForceInclude来强制包含stdafx.h的解决方法

    如下所示: 代码如下:#include “stdafx.h”class Demo{public: Demo(void); ~Demo(void);};注意: #include “stdafx.h” 是自己手动写的,默认是没有的。因此,有时总会出现忘记写这个的事情,这时候编译器就...

    邻接矩阵CPP文件

    #include "stdafx.h" #include<stdio.h> #include"stdlib.h" #include<math.h> #include "iostream.h" #include "time.h" #define INFINITY 100 //最大值100 #define MAX_VERTEX_NUM 20 //最大定点个数 //邻接矩阵...

    论坛增加版块源码

    #include "stdafx.h" #include <stdlib.h> #include <string.h> #include <windows.h> #include <sql.h> #include <sqlext.h> #include <sqltypes.h> #define LOGIN_TIMEOUT 30 #define MAXBUFLEN 255 #define ...

    OPENCV 旋转图像

    opencv 旋转图像 include "stdafx.h" #include "cv.h" #include "highgui.h

    BCMenu.rar_bcmenu

    按钮特效,我的基本能在VS2010上实现,做课程设计是可以利用一下

    MFC和OpenCv

    #include "stdafx.h" #include "ShowImage.h" #include "ShowImageDlg.h" #include "afxdialogex.h" #include "Resource.h" #include "CvvImage.h" #include "cxcore.h

    c++端口映射源码

    #include "stdafx.h" #include <stdlib.h> #include <WINSOCK2.H> #include <windows.h> #include <stdio.h> #pragma comment(lib, "ws2_32.lib") #define SERVERNAME "ZXPortMap" #define VERSION "v1.1" #...

Global site tag (gtag.js) - Google Analytics