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

How to include EXTERNAL PCH file in C++ application?

I have developed a C++ DLL named COMMON that contains some externals classes and functions. I have also developed a C++ program that uses this DLL. When I build C++ program, I include some files from my COMMON DLL. So I have added foldername that…
schlebe
  • 3,387
  • 5
  • 37
  • 50
0
votes
1 answer

Files accessed by GCC while compiling a given code

I came across the topic of the precompiled headers in C, so I started reading about it, in brief, the article(s) I read said that gcc will use precompiled header (h.gch) if there is one, otherwise normal header file(.h) will be used. I just wanted…
user8635842
0
votes
1 answer

Combining PCH, PDB, and Zi leads to puzzling C2859 compile error with VS2017

I have a project that doesn't currently use precompiled headers, but I'd like to make it do so, as I've demonstrated that it leads to real compilation speed improvements in the project. I'd also like to use /Zi, so I can capitalize on the parallel…
acm
  • 12,183
  • 5
  • 39
  • 68
0
votes
1 answer

Visual Studios, using using a precompiled header in C code

I'm importing a code I wrote on linux to Visual Studio and I'm replacing the unistd.h file with this one I found here on Stack Overflow: #ifndef _UNISTD_H #define _UNISTD_H 1 /* This is intended as a drop-in replacement for unistd.h on…
Danzellen
  • 23
  • 1
  • 7
0
votes
1 answer

Visual studio 2017 - building via command line & MSBuild - missing stdafx.h

I have a sln file I usualy compile in visual studio now I try to compile my project on the command line I dont use any precompiled headers, so on the command line it feels something is missing because as I do MSBuild.exe myproject.sln I get the…
phil123456
  • 1
  • 1
  • 6
0
votes
0 answers

Windows Store Package and Precompiled Headers

Using Visual Studio 17, I have created a project that doesn't use precompiled headers. The project compiles and executes successfully, But when I try to create a store app package the build process fails with the message: "unexpected end of file…
0
votes
0 answers

How to precompile every header file?

I was reading clang modules documentation. I understood a few things, I don't know if i'm true or wrong. If I just pass -fmodules and -fbuiltin-module-map to every compiled source file as clang arguments, I will get every benefit of modules such as…
Inline
  • 2,566
  • 1
  • 16
  • 32
0
votes
0 answers

msbuild cannot find precompiled header

I have a dll which I build using msbuild with the command msbuild dll.vcxproj /p:Configuration=Debug and it depends on a static lib. My lib have stdafx.h and stdafx.cpp and they are in different folders. I am using /Yc (create) for stdafx.cpp and…
Nyque
  • 351
  • 3
  • 10
0
votes
0 answers

What change needs to be made to IdIOHandler.hpp to resolve the resulting W8058 Cannot create pre-compiled header 'reason' warning?

Using the IDE Embarcadero C++ Builder Tokyo 10.2, when I build all my project I get the following message repeated: [bcc32 Warning] IdIOHandler.hpp(242): W8058 Cannot create pre-compiled header: initialized data in header The specific line within…
HappyCoding
  • 641
  • 16
  • 36
0
votes
1 answer

Visual Studio C++ console application

I recently had to reinstall visual studio. Previously when I chose Windows Console Application it would load with #include "stdafx.h". Now for some reason it loads with #include "pch.h" and a "hello world" program. I just want it to default load…
0
votes
1 answer

Couldn't make precompiled header work with arm-none-eabi-gcc

I'm using below gcc tool chain. gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors) I could create .h.gch file but could not get .h.gch used while buidling .c files. I used -H and…
LMG
  • 1
0
votes
1 answer

How to use precompiled headers with gcc if linking against openmp

Minimal example: // file: main.cpp #include "pch.h" int main() { std::cout << "test" << std::endl; return 0; } -- // file: pch.h #include Works fine and as expected if I compile this with g++ pch.h g++ main.cpp…
user1709708
  • 1,557
  • 2
  • 14
  • 27
0
votes
2 answers

undefined reference to `function()' while putting C++ code inside C

I kinda have the inverse problem as described here: Combining C++ and C - how does #ifdef __cplusplus work? The whole app is in C code and now I need to add some C++ functions there. But while doing it I get this error: /tmp/cczmWtaT.o: In function…
testin3r
  • 121
  • 1
  • 9
0
votes
1 answer

Precompiled header problems

//........Project for ABC.dll //ABC.h #pragma once class ABC{ public: ABC(){} private: std::vector m_vector; }; //ABC.cpp #include "Stdafx.h" #include "ABC.h" //Stdafx.h #include Till today, I've skipped #include…
JaeJun LEE
  • 1,234
  • 3
  • 11
  • 27
0
votes
0 answers

Build CUDA project on QT makes error on pch file

I'm not an expert of qmake still I'm trying to use CUDA on QT. When I tried to run it with CUDA, it gives me an error for each QT libraries in my pch file "Cannot open include file: : No such file or directory". Is there a link between my…
miyoku
  • 107
  • 1
  • 13