precompiled-headers

In GCC, can precompiled headers be included from other headers?

☆樱花仙子☆ 提交于 2020-01-11 04:16:06
问题 When I compile a c++ file that includes a precompiled header, everything works as expected // test.c++ #include <precompiled.h> #include <header.h> main() {} > g++-4.7 --std=c++11 BLAH... test.c++ -H 2>&1 | grep precompiled.h ! precompiled.h.gch (! means that gcc found and used the precompiled header) However, when I put #include < precompiled.h > into header.h, it doesn't work: // test.c++ #include <header.h> main() {} > g++-4.7 --std=c++11 BLAH... test.c++ -H 2>&1 | grep precompiled.h .

Precompiled headers and normal includes

放肆的年华 提交于 2020-01-04 01:39:11
问题 When using precompiled headers, does it make a difference (or has a bad effect) when I include a header, which I already have included in the precompiled header, also in a regular header? Or in other words: when I include a header x in another header file and at the same time include x in my precompiled header file, does this prevent the optimization provided by precompiled header to kick in? 回答1: No (In general). What's going to happen is that, during compilation, if you're using precompiled

Precompiled Header and MSBuild

限于喜欢 提交于 2020-01-04 01:20:11
问题 I have a precompiled header that needs to be included atop each .cpp in my project. I fear that I will waste a lot of time explaining and fixing that in coworkers code. Is there an MSBuild step that I can do to #include "stdafx.h" at the top of all my .cpp files so it dosen't need to do done manually? 回答1: You have the compiler option /FI pathname which virtually add #include "pathname" at the first line of the file. Note: the equivalent for gcc is -include path . 来源: https://stackoverflow

GCC build time doesn't benefit much from precompiled headers

风流意气都作罢 提交于 2020-01-01 01:54:11
问题 I have a huge project, something about 150 000 LOC of C++ code. Build time is something about 15 minutes. This project consists of many sub-projects of different sizes. I have built separate precompiled headers for each subproject, but when I use them build time stays roughly the same. It seemed that build time is 5-10% percent less, not more. Precompiled headers is definitely used, I use -Winvalid-pch option and I have tried to compile with -H compiler option, my precompiled headers appears

Precompiled headers with DLL solutions. Cannot open precompiled header file

*爱你&永不变心* 提交于 2019-12-21 04:08:42
问题 This worked without error when this solution worked off of .lib files instead of .dll files. I have all of my projects except one currently using a precompiled header, without error . The precompiled header is called " LudoGlobal.h ". I am trying to link the last project to this precompiled header (which exists in a seperate, "Core", project) but I'm getting the following error: Error 4 fatal error C1083: Cannot open precompiled header file: '....\Output\LudoSound\Debug\LudoSound.pch': No

How to implement precompiled headers into your project

蹲街弑〆低调 提交于 2019-12-20 08:34:43
问题 I understand the purpose and reasoning behind precompiled headers. However, what are the rules when implementing them? From my understanding, it goes something like this: Set your project up to use precompiled headers with the YU directive. Create your stdafx.h file and set that to be your precompiled header. Include this as the top include statement in each of your .h files. It this correct? Should you exclude the including it in the files that are included within your precompiled header?

What is the difference between “Create Precompiled Header” (/Yc) and “Use Precompiled Header” (/Yu) in Visual Studio?

冷暖自知 提交于 2019-12-18 12:54:38
问题 I read the documentation in MSDN, but in the end I didn't get a clear idea what is the practical difference between them, exactly. Both seem to require stdafx.h to be added at the top of every *.cpp file. I'm using VS2008. Can anyone help clear things up? 回答1: Well, I think that you must first understand the purpose of precompiled headers. In large projects, it can take ages to process all the headers required by a single client extension for example, so some people prefer to distribute the

How to use precompiled headers in Android NDK project?

怎甘沉沦 提交于 2019-12-18 11:08:12
问题 I'm porting a big C++ project from Visual Studio to GCC for Android. Because of the large number of files, the compile times are glacial. I would like to setup a precompiled header file, but I find the GCC documentation confusing. I have the stdafx.h file which should be the base of the precompiled headers and which is the first included file in all the .cpp sources. Does anybody know what do I need to add to Android.mk to make this work? 回答1: Had the same problem, so there is a solution.

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

无人久伴 提交于 2019-12-13 05:24:25
问题 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 instructions they say: In Configuration Properties > C/C++ > Precompiled Headers, change Use Precompiled Header (/Yu) to Not Using Precompiled Headers And then they explain it: There's no problem using Boost with precompiled headers; these

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

跟風遠走 提交于 2019-12-13 03:55:59
问题 Error 1 fatal error C1083: Cannot open source file: 'FpDebug/BalanceGrabber.pch': No such file or directory c1xx 回答1: Is one of your cpp files configured to generate the precompiled header? I think this is missing. In the project settings/makefile or whatever you use you have to create the pch (precompiled header) first! 回答2: Check your path: specifically, does FpDebug/BalanceGrabber.pch exist? Or can you specify an absolute path for that .pch file? i.e., C:\development\FpDebug/BalanceGrabber