Jump to content
  • Advertisement


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


What does "#pragma hdrstop" do?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 <windows.h>

#include <vcl.h>

#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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!