[Arrangement] How To Make VC ++ compilation faster

Source: Internet
Author: User

[Msnd]

1) Reduce the number of files that VC ++ needs to include and detect during each compilation process;

2) use precompiled headers );

The pre-compiled header is a technology used by many C/C ++ compilers to reduce Compilation Time.

We know that the header file of C/C ++ is included in the source file through the # include statement. Some header files are very large, such as Windows. h. Each compilation takes a long time. To save time, the compiler can process these header files into pre-compilation headers, which is an intermediate form that the compiler can process faster, the common suffix is. PCH and. gch.

For example, the source file game. CPP contains math. h. When VC ++ compiles the game for the first time. when the Pre-compilation header option is enabled, the compiler will generate the pre-compilation header math. PCH: The next time you compile the game. when CPP is used, the compiler does not compile math. h. Instead, use math directly. PCH to save compilation time;

For more information about pre-compiled headers, see

Msnd: http://msdn.microsoft.com/en-us/library/szfdksca (vs.80). aspx

Wiki: http://en.wikipedia.org/wiki/Precompiled_header

3) success;

4) use rebuild as little as possible;

5) use the incremental Link (incremental linking );

Incremental links refer to VC ++ tracking code changes and only matching executable files with changed codes. OBJ, instead of re-linking all. OBJ, which aims to speed up the link, especially in a large project. We often need to edit some code and debug it. Using incremental links, we can save a lot of time.

However, incremental links are costly. The Compiler generates a large number of. ilk files to support incremental links, and the final generated executable files are larger than the non-applicable incremental links.

Note that the incremental link is used only during the editing-debugging process, but only the non-incremental link is used in the release version.

For more information about incremental links, see msdn: http://msdn.microsoft.com/en-us/library/4khtbfyf (vs.80). aspx

6) Use # pragma once;

It works the same as # ifndef... # define... # endif to prevent a header file from being repeatedly compiled during compilation.

7) dynamically link to the CRT;

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.