Using Forceinclude in VC to enforce StdAfx.h solutions _c languages

Source: Internet
Author: User
In the use of VC programming, in order to speed up the compilation, the VC compiler provides precompiled functionality. That is to include stdafx.h in the CPP code, you can use it to precompile.
the following are as follows:
Copy Code code as follows:

#include "stdafx.h"
Class Demo
{
Public
Demo (void);
~demo (void);
};

Note: #include "stdafx.h" is manually written by itself, the default is not.
So sometimes there's always something that you forget to write about, and the compiler will report an error:
Copy Code code as follows:

Error 1 fatal error c1010:unexpected end of file while looking for precompiled header. Did you forget to add ' #include ' stdafx.h ' to your source?
D:\3_code\vc\forceincludedemo\forceincludedemo\demo.cpp 11

It would be nice to have the ability to precompile without adding stdafx.h.

Forceincludes
After a lookup, I found an option for/FI (Name forced Include File) in the compiler.
By using this option, you can avoid such a thing happening.
The setting of this parameter is in the project's Properties dialog box, specifically the force includes attribute in advanced under C + +.
as shown in figure:

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.