Pre-translated header file: stdafx.cpp, stdafx.h

xiaoxiao2021-04-03  226

Excerpted from the "VC Programming Guide" pre-compiled head file: stdafx.cpp, stdafx.h These two files are used to create a precompiled header file xxxProject.pch and a predefined type file stdafx.obj. Since the MFC architecture is very large, there is a lot of header files, and if you compile, you will be compared. Therefore, we put all commonly used MFC headers in stdafx.h, such as afxwin.h, afxext.h, afxdisp.h, afxcmn.h (automatically contain ...), etc. in the console program. Then let Stdafx.cpp contain this stdafx.h file. Thus, since the compiler can identify which files have been compiled, stdafx.cpp is only compiled once and generates a so-called pre-translated head file (because it is stored by the information after the header file is compiled, the name). If the reader does not want some MFC header files to be compiled each time, you can add it to stdafx.h. Adopt the pre-compiled head file can accelerate the compilation process.

If you don't want to use the stdafx.h file (you want to manually add ...), you can remove it, remove it (actually a compilation switch):

In VC6.0. There is a compilation option /yu"stdafx.h "can not contain this.

Select "Project" Project Settings -> C / C -> Premonstration Head -> Create / Use Premetrics (Select "Do not use pre-compiled head")

If this switch is in the state of "using the precompiled head", each .cpp file must have a #include "stdafx.h" instruction

转载请注明原文地址:https://www.9cbs.com/read-131562.html

New Post(0)