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

Common (automatically included) headers in Androin NDK build?

I want to set up common header files to be included automatically into every include/source file in the project. I have to build with ndk a large cocos2d-x project which compiles in Xcode and has some commonly used headers in prefix.pch. Is it…
0
votes
2 answers

How to check programmatic by preprocessor directive whether a pre-compiled header is required in Visual C++?

Sometimes it would be useful to know whether the compiler requires a pre-compiled header or not, and how the header file is called. My goal is to add some preprocessor directives like this: #ifdef REQUIRES_PRECOMPILED_HEADER #include…
0
votes
2 answers

How to put macros and constants into .pch file in an iOS project?

I heard that the .pch is good for putting macros and constants definitions, so for its default content: #import #ifndef __IPHONE_4_0 #warning "This project uses features only available in iOS SDK 4.0 and later." #endif #ifdef…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
-1
votes
3 answers

Visual Studio is skipping the header files while debugging the code

I am trying to run a program for face detection using opencv. I have correctly included paths for opencv libraries in properties but still the program is giving error, failed to build the executable file and skipping the header files during…
Abdullah x
  • 37
  • 2
  • 4
-1
votes
1 answer

Trade-off of using large precompiled headers

As I understand it a precompiled header is basically a dump of the compiler's state after processing the given header. When you compile a source file that includes a precompiled header, you trigger reloading that state from disk, which is cheaper…
Joseph Garvin
  • 20,727
  • 18
  • 94
  • 165
-1
votes
1 answer

Adding/Removing headers has no effect

I have used std::invalid_argument exception class in my code. So I also had included the header in the precompiled header (pch.h in my case). But then I removed from pch.h and the code compiled successfully on GCC 11.2 and I…
digito_evo
  • 3,216
  • 2
  • 14
  • 42
-1
votes
1 answer

Unable to use Precompiled headers in visual studio

I've seen several questions discussing this topic but none of their solutions seems to apply here. I have several libraries that I don't wont to be compiled every time I build the project so I've created "b5pch.h" and b5pch.cpp"…
Boss
  • 21
  • 6
-1
votes
1 answer

ld: symbol(s) not found for architecture x86_64 when including header file

I am writing the following code to print the underlying Operative System. It's incomplete and might be wrong (appreciate advices for the wrong, no need for complete as it's for learning purposes). platform.c #include
aerijman
  • 2,522
  • 1
  • 22
  • 32
-1
votes
1 answer

Main file don't sees incuded header in stdafx.h

Hey I have strange problem... When I'm adding a class into my project in VS 2015 Im including new class into stdafx.h, and stdafx I including to file with main function. When I compiling a program, VS throws Error: I show it on the…
-1
votes
1 answer

Calling Header file in C++

I'm having issues utilising header file that I created. Object from the class defined in invoice is not created in the main method. Here's the contents of my header file that I made: invoice.h #pragma once #include…
-1
votes
1 answer

Exporting a visual studio c++ project for use in another project, without revealing the .cpp and .h source files

I have a visual studio project called "TopSecretProject" that I want to share with an anonymous developer user, without revealing any of my code, including the header files (Since my .h files include the structure of my project ant the user…
-1
votes
1 answer

Does visual C++ check if it needs to re-generate its pch if I use /Yc

It seems that when I set the option to /Yu, it just uses whatever pch there is, without checking if it needs to be updated, meaning it would keep a list of headers it precompiles and check if those files has been updated since the last time they…
jokoon
  • 6,207
  • 11
  • 48
  • 85
-2
votes
1 answer

is there g++ 7.2 option to emit a message when it is using a precompiled header file?

I know about the '-H' option but that is way too verbose when the precompiled header is NOT used. What I want is the the output -H gives when it DOES use a preocompiled header. I suspect the answer is "no" but I thought I'd throw a hail mary and…
-2
votes
2 answers

Should stdafx.h/.cpp be removed from a static library project in C++?

While my static library is working fine, I noticed the default settings came with the following files: stdafx.h stdafx.cpp targetver.h I don't expect this library to be huge. I wish to minimalize as much as possible. Is stdafx.h/.cpp…
Bob
  • 327
  • 3
  • 12
-2
votes
2 answers

Why isn't include stdafx.h not enough for VisualStudio?

I understand that the purpose of precompiled header is about to speed up compilation process by using object file that was already compiled once and link it to actual project. But what I do not uderstand Is why should I explicitly enforce Visual…
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
1 2 3
30
31