[C/C ++] _ [solution to slow project compilation after boost is used]

Source: Internet
Author: User

Scenario: when the regular module of the boost library is used, compilation is too slow. I read the header file.

[Cpp]
# Include <boost/regex. hpp>

It depends on a considerable number of header files, which should be the root cause.
Currently, it is known that only the pre-compiled header can be used in a computer with a low cpu. This problem occurs only after the code is modified. Www.2cto.com

--- It can save 20 seconds.

1. Pre-compiled header file generation. Similarly, if you use vc ++, you can use your own generation method.
G ++-o/E/software/Lib/common/boost-1.46.1/win32/release/share/include-gch/StdAfx. h. gch-x c ++-header-c src/StdAfx. cpp-g-Wall-IE:/software/Lib/common/boost-1.46.1/include

2. It can only be placed in the first line of the. cpp file. Note that it is not a. h file. Otherwise, an error will be prompted. Otherwise, the previous content will be ignored.
Include/data/schema_analyse.h: 11: 20: error: StdAfx. h: No such file or directory
There is a problem that has not been solved, although it has not been encountered.
3. but there is a problem not in the header file, that is, the header file contains the structure of the 3rd-party library. When the class member variable is used, the header file must contain the 3rd-party library, this slows down compilation. that is to say, if a pointer is used in the header file, variables of the reference type can be used to make good use of the pre-compiled header file. but what if it is inherited?

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.