What does "#pragma hdrstop" do?
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:
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement