Questions tagged [precompiled-headers]

A precompiled header is a header file that has statically compiled but still separate from its final executable in order to speed up compilation of dependent files.

In C and C++, precompiled headers allow for quicker compilation times by keeping the definitions from a given header in an compiled state. This allows the compiler to quickly incorporate the header when a file dependent on the header is being compiled.

Rather than having to parse through code, precompiled headers allow the compiler to skip directly to a more intermediate state. For headers that are used frequently this can result in significant compile-time savings.

454 questions
4
votes
0 answers

What compile speed improvement can I expect with modules in Visual Studio 2015

Visual Studio 2015 supports modules. I'm excited about this feature, and although I know it has important implications over and above build time, that's my interest right now. I'm thinking of larger code bases of the order of half a million lines of…
TooTone
  • 7,129
  • 5
  • 34
  • 60
4
votes
0 answers

Error 'boost::hash_combine': recursive function template definition after Visual Studio 2015 Update 2 installed

After my Visual studio 2015 updated from Update 1 to Update 2 my project doesn't compiling. I get an error 'boost::hash_combine': recursive function template definition boost-1_60\boost\functional\hash\hash_fwd.hpp(25): note: see declaration of…
Ufx
  • 2,595
  • 12
  • 44
  • 83
4
votes
1 answer

Is there any way to use multiple precompiled headers simultaneously with Clang?

I am playing around with a clang++ command line in order to learn how precompiled headers work. I've got something like this: clang++ [several lines of options] sourcefile.cpp -o sourcefile.o -include durr.h -include hurr.h where the two headers…
mjwach
  • 1,174
  • 2
  • 9
  • 25
4
votes
2 answers

Precompiled headers question

I am right now reorganizing my project and what recently was a simple application now became a pair of C++ projects - static library and real application. I would like to share one precompiled header between two projects, but face some troubles with…
M. Williams
  • 4,945
  • 2
  • 26
  • 27
4
votes
2 answers

C/C++ - precompiled headers - encapsulation, how to, and why is config required?

I understand the idea that precompiling headers can speed up build times, but there are a handful of questions that have thus far prevented me from grokking them. Why does using precompiled headers require the developer to configure anything? Why…
cp.engr
  • 2,291
  • 4
  • 28
  • 42
4
votes
1 answer

Decrease clang compile time with precompiled headers

I am working on a database project that compiles queries (expressed in some higher level language) into c++ code. This code is compiled and executed by the database. That part works perfectly fine. Right now, I am trying to reduce the compile time…
moo
  • 486
  • 8
  • 22
4
votes
1 answer

Why do compilers that support precompiled headers typically only allow one?

There are potential benefits to using multiple precompiled headers. Suppose there exists a project in which there are several headers that change infrequently and are used in many source code files. These headers tend towards two clusters, A and B.…
4
votes
4 answers

#define and how to use them - C++

In a pre-compiled header if I do: #define DS_BUILD #define PGE_BUILD #define DEMO then in source I do: #if (DS_BUILD && DEMO) ---- code--- #elif (PGE_BUILD && DEMO) --- code--- #else --- code --- #endif Do I get an error that states:…
MLS
  • 615
  • 1
  • 8
  • 12
4
votes
1 answer

gcc precompiled headers weird behaviour with -c option

Short story: I can't make precompiled headers work properly with gcc -c option. Long story: Folks, I'm using gcc-4.4.1 on Linux and before trying precompiled headers in a really large project I decided to test them on simple program. They "kinda…
pachanga
  • 3,003
  • 4
  • 30
  • 45
4
votes
1 answer

Using precompiled headers in my project (clang/llvm, but gcc as well). How to deploy the -include option at make?

I have a quite large project that would enjoy some speedup in compilation. I'm on OSX 10.8 (clang/llvm), but I will port this to gcc as well. I am trying to tinker with .pch files but I noted in the llvm documentation that pch files are only parsed…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
4
votes
1 answer

Rebuild all but precompiled headers in Visual Studio

How would it be possible to configure VC++/Solution/Projects to rebuild all but the precompiled headers?
Marcin Seredynski
  • 7,057
  • 3
  • 22
  • 29
4
votes
1 answer

PRECOMPILED HEADERS not working in debug build with Qt Creator / qmake / MinGw

In Qt Creator, I have a pro file using PRECOMPILED HEADERS. The build works just perfect when I build in Release mode. But building in Debug mode gives errors, generating object files failing. Example: 17:12:40: Running steps for project…
Hugo
  • 157
  • 2
  • 9
4
votes
4 answers

Possible to generate hpp or h file automatically?

Sorry for the noop question, but is it possible (In Visual C++ 2010 or some other IDE) to generate the header file automatically based on the variables and code in the actual source code (.cpp) files? Thanks!
AZhu
  • 1,312
  • 6
  • 22
  • 40
4
votes
4 answers

Eclipse CDT - Precompiled Header

I am looking for a straight forward way to use precompiled headers for a C++ project using Eclipse / CDT. The stuff does work when running from command line but I am looking for an easy way to integrate it into Eclipse. Any suggestions ?!
Maik
  • 541
  • 4
  • 15
4
votes
1 answer

How to use two precompiled headers. One for managed and one for unmanaged code. xxx.pch is not a valid precompiled header file

I have mixed C++ project (managed and unmanaged). The unmanaged is using lots of libraries such as boost. They are all included in the stdafx.h file. I am trying to have two separate precompiled headers, one managed (stdafx.h) and one for unmanaged…
Miro Bucko
  • 1,123
  • 1
  • 13
  • 26