precompiled-headers

Precompiled header and Visual Studio

梦想的初衷 提交于 2019-12-12 13:25:40
问题 Is there a way to set Visual Studio solution parameters so it just create precompiled headers without building whole solution. Specifically, it is a huge c++ solution with many projects in itself. Thank you. 回答1: Only select the pch creator source file (usually stdafx.cpp), and compile that (Ctrl-F7, or right-click it and select 'Compile') More info since it doesn't seem to be working for you: In every project that uses a precompiled header, there is one source file that is used to create the

c++ precompiled header defined in a header VS2010. Compiler can't find

做~自己de王妃 提交于 2019-12-12 09:57:27
问题 I've inherited some code that did something like this, Header: HeaderFile.h #ifndef HEADERFILE_H #define HEADERFILE_H #ifndef HEADERFILE_PCH_H #include<LibStuff> #include<LibStuff2> #include<LibStuff3> #include<LibStuff4> #include<LibStuff5> #endif #include "FilesInProject" Class A { //Code }; #endif Cpp: HeaderFile.cpp #include "HeaderFile_pch.h" //(1) #include "HeaderFile.h" //More code I understand what a precompiled header is for and what the code is doing here (sort of). When I copy

How do I access a Macro defined in my pch from a cocoapods lib?

南笙酒味 提交于 2019-12-11 03:33:35
问题 Context We have a big project, so the application is separated from some common code. Each one goes in its own repo, and the app uses the common code as a lib via cocoapods. Situation Now, we need to toggle some very specific functionality, contained in the lib. But the condition to enable/disable it is a MACRO defined in the application-prefix.pch file (I know, not cool). Problem The code in the lib (included as a Pod) doesn't "see" the MACRO defined in the pch file. So, we can't actually

Decrease clang compile time with precompiled headers

流过昼夜 提交于 2019-12-10 20:08:13
问题 I am working on a database project that compiles queries (expressed in some higher level language) into c++ code. This code is compiled and executed by the database. That part works perfectly fine. Right now, I am trying to reduce the compile time for the C++ query code. I was wondering whether I can use precompiled headers to gain performance here. The query is translated into a file called Query.cpp which includes library/src/Database.hpp. The Database.hpp file includes further files like

Is including resource.h in precompiled header a good idea?

假如想象 提交于 2019-12-10 15:43:06
问题 The VS-IDE will write //{{NO_DEPENDENCIES}} to resource header files. This comment is actually a feature that prevents (unnecessary) rebuilding of cpp files that include the resource header. But, like stated in the MSDN, this can lead to "undesirable side-effects". In our project we do have the resource.h included in the stdafx.h for pre-compilation. Unfortunately the precompiled header is not rebuild, if the resource file changes... If the NO_DEPENDENCIES is removed, it works (but it's

What does #pragma hdrstop without parameter do when used in multiple files?

末鹿安然 提交于 2019-12-10 12:40:16
问题 What is the practical value ("what does it do") of putting #pragma hdrstop (no filename parameter) in a couple of source (cpp) files? Note that the MSDN docs are (once again) as clear as mud to me. Edit/Note: I'm asking this, because this answer and the article it links to seem to recommend that. But I do not understand what benefit it has to have a separate pch file for each compilation unit. 回答1: The answer to the original question is that the purpose of having #pragma hdrstop in a file

VS2008 win32 project defaults - remove default precompiled headers

烂漫一生 提交于 2019-12-10 09:36:52
问题 I have been through every option to try to find a way to get the IDE to let me create a new win32pject without precompiled headers. I have read every thread on this forum with the words "precpmpiled headers" in it and the closest I got was: Precompiled Headers Using 2008 pro (not express, althought the behaviour seems to be similar) I go to: File -> New -> Project This opens the New Project dialog in which I select Visual C++ Win32 Project, enter a name and hit OK. THen I get the "Win32

cc1plus.exe crash when using large precompiled header file

流过昼夜 提交于 2019-12-10 01:31:57
问题 I'm having an issue using precompiled header files with MinGW. The compiler seems to find the precompiled header file but cc1plus.exe crashes immediately after (cc1plus.exe has stopped working). I've understood that this might be in connection with cc1plus.exe's low stack size, so I did the following to increase it: editbin cc1plus.exe /STACK 33554432 and I also tried to no avail: editbin cc1plus.exe /STACK 32768k This however did not solve it as it still keeps crashing whenever I try to

Why do I need to include the precompiled header in all the files in C++?

拟墨画扇 提交于 2019-12-08 03:17:08
问题 If I don't include the stdafx even in an empty .cpp, I get this error fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source? Why do I need to include it even in dummy files? 回答1: If you use them, then you must include them. But you can turn them off in the project properties. However, the recommended way to use them is to "Force Include" the PCH from the command line , so that the file itself doesn't contain

Objective-C typedef enum in global constants file

纵饮孤独 提交于 2019-12-07 00:28:37
问题 OK, this is related to question "Constants in Objective C". I created Constants.h and its corresponding Constants.m file: // Constants.h extern int const BOOKS; typedef enum SSDifficultyLevel { EASY = 0, MEDIUM = 1, HARD = 2 } SSDifficultyLevel; // Constants.m int const BOOKS = 66; My question: Is OK for the enum to be typedef 'd in Constants.h ? The code is compiling fine (no warnings or errors so far) but I was wondering if this is the right way to do it, as the solution provided in the