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
2
votes
1 answer

VS2015/VC++ disable default #include "stdafx.h" in new class templates

I'm working off of a branched project in VS2015, and every time I create a new class file from the default template, it adds #include "stdafx.h" by default. The solution does not use precompiled headers, and has no such file. It appears the project…
2
votes
1 answer

How do you turn off "precompiled header", default "checked" MS VS

When I make a new project, the precomp header defaults on. How do I make it default off?
Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78
2
votes
1 answer

Makefile/double compilation

Recently I noticed (after others have extended the project) that the compile time significantly increased. I was suggested to make use of c++ precompiled headers. The "include" parts are moved to a separate file "precompiled.h" #include…
user506901
  • 699
  • 4
  • 9
  • 18
2
votes
0 answers

PCH being ignored when added to existing tvOS project

My problem is that I am trying to add a PCH file to an existing tvOS project but it is not taken into consideration and I can't find any resolution to this issue or at least why it is happening. I've stripped the project to a bare minimum and…
2
votes
0 answers

Nifty counter in precompiled header does not work

To fix a problem caused by the static (de-)initialization order fiasco I tried to use the Nifty Counter idiom aka Schwartz Counter. I noticed, however, that it does not work if the header file containing the static initializer is included inside…
sigy
  • 2,408
  • 1
  • 24
  • 55
2
votes
1 answer

Disable looking for pre-compiled header file in clang front-end

I have created a C++ frontend using clang lib-tooling and RecursiveAStVisitor. I use pre-generated compile_commands.json file to load compilation database. Sometimes compile command for a source file contains -include compiler argument. For…
2
votes
0 answers

shared precompiled header for debug build in visual studio

How can the error "LNK4206 precompiled type information not found" be prevented in a solution with a shared precompiled header? I try to configure a visual studio 2015 update 3 solution with all projects sharing the same precompiled header in an…
boojum
  • 181
  • 2
  • 15
2
votes
1 answer

C library public header interface

I am building a range of C libraries to improve separation of code in a large codebase. I would like to enforce strict separation using minimal public library interfaces. The libraries consists of several modules (c + h files), some with internal…
CSS
  • 21
  • 2
2
votes
1 answer

PCH compiler options for MSVC

I am a bit confused about when to use /Yc (create PCH) as opposed to /Yu (use PCH.) For a project that has never used precompiled headers in the past, naturally, the PCH file will not exist initially. Am I supposed to fire off a initial build with…
ForeverLearning
  • 6,352
  • 3
  • 27
  • 33
2
votes
0 answers

How to use precompiled headers with python wheels?

I'm writing a python packages which I would like to distribute as a wheel, so it can be easily installed via pip install. As part of the functionality of the package itself I compile C++ code. For that, I distribute with the package some set of…
dcmm88
  • 1,445
  • 1
  • 12
  • 30
2
votes
0 answers

Can cotire be made to work properly with Boost?

PROBLEM SUMMARY We took a crack at using cotire, the Compile-Time Reducer, as our precompiled header system due to the extremely long compile times caused by usage of the Boost C++ template library. We are getting poor to dangerous results-- the…
breakpoint
  • 916
  • 9
  • 16
2
votes
2 answers

What does Visual Studio use vc90.pdb for?

According to http://msdn.microsoft.com/en-us/library/yd4f8bd1.aspx there's 2 .pdb files for a project. project.pdb I use to allow loading minidumps later on, but what exactly is vcx0.pdb used for? If it's missing, it's not a problem, and I don't…
Pieter
  • 1,191
  • 1
  • 11
  • 29
2
votes
1 answer

If a particular header already included in stdafx.h - do I need to (have to/should to) to explicitly include it in a .cpp file?

If a particular header is already included in stdafx.h - do I need to (have to/should to) to explicitly include it in a .cpp file (which already includes the stdafx.h) ?
Andrew
  • 295
  • 4
  • 10
2
votes
1 answer

Using precompiled headers with a static library project

I am in need of some advice on how to setup my project. I'm building a static library and want to know if the way I'm using precompiled headers is correct before I go too far. So far, my stdafx file is just including (for types like DWORD, etc.)…
Matthew
  • 24,703
  • 9
  • 76
  • 110
2
votes
0 answers

Any way to automatically handle precompiled headers in visual studio 2015

I have a solution in Visual Studio 2015 that includes multiple related C++ projects, static libraries that are built then linked into a single executable. Here's a simplified diagram of the solution: + Solution + Project 1 (static library) -…
Colen
  • 13,428
  • 21
  • 78
  • 107