A brief talk on the precompiled header file in VC put the problem analysis _c language

Source: Internet
Author: User
Write the program in C + +, must use the precompiled header file, is that stdafx.h.
But I always thought that if you included stdafx.h in a. cpp file, you used the precompiled header file, but that's not true.
in VC + +, the precompiled header file refers to the header file placed in the stdafx.h to be effective.
are as follows:
File:stdafx.h
Copy Code code as follows:

Stdafx.h:include file for standard system include files,
or project specific include files that are used frequently, but
are changed infrequently
//
#pragma once
#ifndef _WIN32_WINNT//Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501/appropriate value to target other versions of Windows.
#endif
#define WIN32_LEAN_AND_MEAN//Exclude rarely-used stuff from Windows headers

Copy Code code as follows:

Please note that the header file to use the precompiled effect should be placed here.
#include <Windows.h>
#include "xxx.h"

Copy Code code as follows:

Todo:reference Additional headers your program requires

In Stdafx.cpp, the default is the following:
Copy Code code as follows:

Stdafx.cpp:source file that includes just the standard includes
Cpptesthelper.pch'll be the pre-compiled header
StdAfx.obj would contain the pre-compiled type information
#include "stdafx.h"
Todo:reference any additional headers your need in STDAFX. H
And not in this file

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.