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
2 answers

Should I define macros in a .pch file or a .h file?

I have defined macros in my pre-compiled header file as well as in another header file named Constants.h. Which is the better way, and why?
Samir
  • 902
  • 9
  • 23
0
votes
1 answer

unable to write macros with nested if in PCH file

I'm trying to write this piece of code in the pch file : #define someString if(x == 5) { if(y == 7) { someString = @"Test1" } else { someString = @"Test2" } } else { someString = @"TEST3" } but to no avail .. anybody can help…
JAHelia
  • 6,934
  • 17
  • 74
  • 134
0
votes
3 answers

When do i want to turn off "precompiled header" in visual studio?

First of all i want to say that I read about precompiled headers and I understand that this is an optimization that saves me the time of compiling headers over and over on every built. I'm reading the documentation of boost and I see that in the…
OopsUser
  • 4,642
  • 7
  • 46
  • 71
0
votes
1 answer

Carbon/Carbon.h won't precompile moving from SDK 4 to SDK 5

I'm trying to update an older Mac app which is being built with SDK 4. When I change it to SDK 5 in the project settings, compilation fails doing just the Carbon/Carbon.h file. It comes back with LP64 is not defined, MATH64_USE_INLINE is not defined…
john elemans
  • 2,578
  • 2
  • 15
  • 26
0
votes
2 answers

Prefix Header in all source files except one?

Is it possible to use the AppName-Prefix.pch file to import a given header file in all source files except one? Problem: I have followed the approach described here: https://stackoverflow.com/a/617559/1062572 to overwrite a C function call, namely…
0
votes
0 answers

Set in cmake for VS "not using precompiled headers"

I'm using visual studio 2013 with a compiler option /MP, which doesn't support precompiled headers. How do I set in CMakeLists.txt the "not using precompiled headers"? EDIT: Resolved. Mario made me thinking, and I checked again my cmakelists and it…
Zohar Levi
  • 614
  • 6
  • 16
0
votes
1 answer

Cannot figure out how the .pch file is referenced by the project

Sorry about the novice question, but in this simple iOS tutorial I could not figure out where in the project (in Info.plist or somewhere else) is stated that the file HelloThere_Prefix.pch relates to the other files. I understand that it links to…
Piovezan
  • 3,215
  • 1
  • 28
  • 45
0
votes
1 answer

Is it possible for intellisense to use "stdafx.h" from within nested folders?

I'm using "stdafx.h" from a folder structure (from "src/resource/font.cpp"). This compiles fine but intellisense doesn't get the file, so it is effectually disabled. Do you know if there is a workaround for this?
user10F64D4
  • 6,531
  • 1
  • 13
  • 12
0
votes
2 answers

Why I am getting this error in c++ code

I have this simple code: std::ifstream ifs; ifs.open ("test.txt", std::ifstream::in); char c = ifs.get(); while (ifs.good()) { std::cout << c; c = ifs.get(); } ifs.close(); But I am getting a lot of error? such as: Error 9 error C3083:…
mans
  • 17,104
  • 45
  • 172
  • 321
0
votes
3 answers

What does fatal compile error C1083: Cannot open source file mean?

Error 1 fatal error C1083: Cannot open source file: 'FpDebug/BalanceGrabber.pch': No such file or directory c1xx
Benit
  • 1
0
votes
1 answer

pre-processor #defines and how to use globally without a pre-compiled header?

The development I have done over the last few years uses a lot of pre-compiled headers. One for each product. The pre-compiled headers are used in a way to #define items that each product needs. This does keep the code rather clean and portable…
Jasmine
  • 15,375
  • 10
  • 30
  • 48
0
votes
3 answers

Hello World (C and C++) for WinCE application - Visual Studio 2008

I'm a beginner for Visual Studio 2008 (32-bit). The WinCE version I'm using is 7.0 Evaluation. I created a new project as, New Project -> Platform Builder-> OS Design Selected the BSP as, BSP: Generic CEPC:x86 When the design template highlighted…
Gomu
  • 1,004
  • 5
  • 16
  • 36
0
votes
2 answers

targeting iPhoneOS 2.2.1

I don't believe that I am using any 3.0 specific APIs, but somehow whenever I compile I get a warning "This project uses features only available in iPhone SDK 3.0 and later", and then a bunch of errors. If I change the Base SDK to 3.0, the warning…
George Armhold
  • 30,824
  • 50
  • 153
  • 232
0
votes
3 answers

Small question about precompiled headers

Looking at an open source code base i came across this code: #include "StableHeaders.h" #include "polygon.h" #include "exception.h" #include "vector.h" ... Now the StableHeaders.h is a precompiled header which is included by a 'control' cpp to…
Adam Naylor
  • 6,172
  • 10
  • 49
  • 69
0
votes
1 answer

How do I make precompiled headers work on Netbeans?

Question as title. Netbeans does not offer pre- or postbuild steps and also does not offer this setting by default. Is there any convinient way I can make this work or can I edit some configs? I think the makefile is getting regenerated when you…
DeleteMe
  • 197
  • 1
  • 12