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
0
votes
0 answers

Use a static library in application that uses precompiled headers

My application uses precompiled headers and I am trying to use a static library which does not use precompiled headers. The problem is that I am getting a bunch of warning: when attempting to rebuild my application: #include "some_library_hdr.h"':…
Caroline Beltran
  • 888
  • 2
  • 9
  • 22
0
votes
1 answer

Prefix.pch not found but only when profiling

The app runs fine but when I go "Profile" I'm getting the following error: clang: error: no such file or directory:…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
0
votes
0 answers

Precompiled Header not found

In my program I have 3 files right now. main.cpp, DirectXTemplatePCH.h, DirectXTemplatePCH.cpp The only line in DirectXTemplatePCH.cpp file is the include for the header. I have gone into the properties and with All Configurations selected…
Desenski
  • 61
  • 1
  • 3
  • 9
0
votes
1 answer

Precompiled Headers with Qt and g++ (QtCreator)

I'm using precompiled headers on a Qt project to speed up compilation time. I'm using Qt 4.6.2 .When I compile the project using macx-g++ (meaning the g++ compiler) it doesn't include the stdafx.h automatically for each header. When compiling under…
Boris Gougeon
  • 864
  • 2
  • 11
  • 23
0
votes
1 answer

Xcode CodeSense error - Property not found on object of type, but project compiles

I have this in my .pch file: #import "UIViewController+Loader.h" The implementation for the category looks like this: static char kUIViewControllerBaseViewKey; @implementation UIViewController (Loader) - (void)setLoader:(LoaderView *)loaderView…
soleil
  • 12,133
  • 33
  • 112
  • 183
0
votes
1 answer

Separate Class File errors?

I'm new to C++ and I am trying to separate class files for a game I made, but when i do, VS generates a load of errors. Cube.h: #include "stdafx.h" #ifndef CUBE_H #define CUBE_H struct PlayerCube { //code }; #endif //CUBE_H Cube.cpp: #include…
Tom
  • 2,372
  • 4
  • 25
  • 45
0
votes
2 answers

Using precompiled headers in gcc

I am investigating using precompiled headers to reduce our compile times. I have read the documentaiton on the subject here: https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html, where I read the following: Only one precompiled header can…
Spacemoose
  • 3,856
  • 1
  • 27
  • 48
0
votes
2 answers

using #define in a .pch

If I define something in a pre-compiled header like: #define __BUILD_MAC__ and then in a header file do: #ifdef __BUILD_MAC__ typedef void* HINSTANCE; #endif This should work. But for some reason It isn't. I know because when I compile I get…
ML.
  • 195
  • 1
  • 1
  • 8
0
votes
1 answer

two projects using same .cpp file & header which has include "stdafx.h"

I have several functions in a .cpp file and I want several of my projects use the same file. So instead of copy them to different directories just add them (from original location) to project file in visual studio and use them. The problem is…
Roozbeh G
  • 427
  • 4
  • 18
0
votes
1 answer

Precompiled STL with GCC

There's a code that includes a lot of standard library headers. The code is situated in one file, and I cannot create any other C++ source files in that project (sic). I would like to increase the performance of the build process using precompiled…
polkovnikov.ph
  • 6,256
  • 6
  • 44
  • 79
0
votes
1 answer

Advantages of removing includes which are already in precompiled header?

I'm aware of disadvantages, but is there an improvement in compile time when you clean your sources from #include statements which are already in precompiled header? I understand that header guards (be it #pragma once or #ifdef guards) will ensure…
mondzi
  • 3
  • 3
0
votes
1 answer

Restore precompiled header

I have a C++ console project that I included a precompiled header in the setup. I accidentally deleted the file from my project and now I can't compile because I get error C1083: Cannot open precompiled header file: 'Debug\Project.pch': No such file…
einsteinsci
  • 1,137
  • 1
  • 8
  • 22
0
votes
2 answers

Adding SpriteKit to Empty Application

I had a previous question about whether or not I could add SpriteKit to an Empty Application. Now that I know that this is possible, I had one more question. I have added the SpriteKit.framework to the correct area in Xcode. After this, do I have…
Brian Tracy
  • 6,801
  • 2
  • 33
  • 48
0
votes
1 answer

What exactly is compiled in precompiled headers?

From what I know, headers used properly should only contain function prototypes and defines, which are not compiled. Only the global variables will be compiled. So why bothering with precompiled headers when there's almost nothing to compile ? Am I…
0
votes
0 answers

Contradictions against including ComObj.hpp for non-COM programs?

I'm fighting against the last compiler warnings in a legacy project (MS-COM server, C++-Builder 6), and there are a few warnings left that I ignored previously, because they were raised from generated code for type library stubs (I quote the…
Wolf
  • 9,679
  • 7
  • 62
  • 108