文件中有”stdafx.h”还要加上<windows.h>才能运行通过?(C++)

来源:百度知道 编辑:UC知道 时间:2024/06/04 22:43:20
在某些编程过程中,非要加上<windows.h>才能通过,到底stdafx.h和windows.h各代表什么,什么情况下用其中一个,或都两个都要加上呢?

windows.h中也包含一些头文件,
有:
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>

#include <winsock.h>
…………

The WINDOWS.H file contains definitions, macros, and structures to help you write source code that is portable between versions of Microsoft Windows

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