What is the use of the stdafx. h and targetver. h header files in Visual Studio 2010?

Source: Internet
Author: User
Tags visual studio 2010
From Baidu ~
There is no function library in stdafx. h, but some environment parameters are defined so that the compiled program can run in a 32-bit operating system environment.
The include files for Windows and MFC are very large. Even if there is a fast processing program, it takes quite a long time to compile the program. Since each. cpp file contains the same include file, it is silly to process these files repeatedly for each. cpp file.
To avoid this waste, Appwizard works with the VisualC ++ compiler as follows:
◎ Appwizard creates the stdafx. h file, which contains all the mfcinclude files required by the current project file. This file can change with the selected options.
◎ Appwizard, then stdafx. cpp is created. This file is usually the same.
◎ Then Appwizard creates the project file, so that the first compiled file is stdafx. cpp.
◎ When Visual C ++ compiles the stdafx. cpp file, it stores the result in a file named stdafx. PCH. (The extension PCH indicates the precompiled header file .)
◎ When Visual C ++ compiles each subsequent. cpp file, it reads and uses the. PCH file it just generated. VisualC ++ does not analyze windowsinclude files any longer, unless you have edited stdafx. cpp or stdafx. h.
This technology is very sophisticated. Don't you think so? (Also, Microsoft is not the first company to adopt this technology, Borland is .) In this process, you must follow the following rules:
◎ Any. cpp file you write must first contain stdafx. h.
◎ If you have a majority of. cpp files in the project file that require. H files, add them to stdafx. H (back) and pre-compile stdafx. cpp.
◎ Because the. PCH file has a lot of symbolic information, it is the largest file in your project file.
If your disk space is limited, you want to delete the. PCH file from the project file you have never used. They are not required when the program is executed, and they are automatically re-established as the project file is re-established.

What is the use of the stdafx. h and targetver. h header files in Visual Studio 2010?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.