• ### Popular Now

• 11
• 14
• 12
• 10
• 11

#### Archived

This topic is now archived and is closed to further replies.

# What does "#pragma hdrstop" do?

This topic is 5997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Title says it all...

##### Share on other sites
Click on it and hit F1. It''s in the doc.

##### Share on other sites
In C++ Builder, #pragma hdrstop instructs the preprocessor that it shouldn''t generate precompiled headers for any #included files after that point.

Precompiled headers speed up compilation by reducing the time it takes to read and parse the header files. This is of particular interest for things like <windows.h>, which are very large.

It seems that rather than generating a precompiled form of each header, C++ Builder will precompile all the headers used in a .cpp file up until #pragma hdrstop. This means that if you include different headers in each file, C++ Builder will precompile each set of headers seperately, even those headers that are included in all files.

The best solution is to do this at the top of each file:

  #include #include #include ... whatever else you need ...#pragma hdrstop

Assuming this is the same at the start of every file, the headers will be precompiled only once, making everything faster. Unfortunately, #pragma hdrstop only does its stuff in .cpp files, and not .h files.

There''s an article about it here.

Abolish Software Patents! | freepatents | lpf