precompiled-headers

Is it OK to remove Prefix.pch file from the Xcode project?

╄→гoц情女王★ 提交于 2019-11-27 01:01:48
问题 The Xcode project generates Prefix.pch file automatically. When I deleted this file and tried to build, I got build error saying ' * _Prefix.pch' file is missing. Is Prefix.pch file is a must for compiling with Xcode? How can I build without the Prefix.pch file? 回答1: In Xcode, go to your target's build settings (Command-Option-E, build tab) and uncheck Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER). You can also remove the value of the Prefix Header setting if you wish. Prefix

Precompiled Headers

一世执手 提交于 2019-11-27 00:32:41
I have a sample project (not mine) which is in Visual C++ 6. I'm trying to convert it to Visual Studio 2008. The older project is using precompiled headers. Now the questions are: What are precompiled headers? Since the older project is using precompiled headers. I'll also use them in Visual Studio 2008 (the new project). But I get errors saying that "Did you forget to include stdafx.h" , to remedy the problem, I include "stdafx.h" in every source file. That worked perfectly. But the older project was not including "stdafx.h" in every file? Then how can I opt-out to include "stdafx.h" in each

Is there a way to use pre-compiled headers in VC++ without requiring stdafx.h?

跟風遠走 提交于 2019-11-26 22:58:51
问题 I've got a bunch of legacy code that I need to write unit tests for. It uses pre-compiled headers everywhere so almost all .cpp files have a dependecy on stdafx.h which is making it difficult to break dependencies in order to write tests. My first instinct is to remove all these stdafx.h files which, for the most part, contain #include directives and place those #includes directly in the source files as needed. This would make it necessary to turn off pre-compiled headers since they are

Why use precompiled headers (C/C++)?

Deadly 提交于 2019-11-26 22:20:40
问题 Why use precompiled headers? Reading the responses, I suspect what I've been doing with them is kind of stupid: #pragma once // Defines used for production versions #ifndef PRODUCTION #define eMsg(x) (x) // Show error messages #define eAsciiMsg(x) (x) #else #define eMsg(x) (L"") // Don't show error messages #define eAsciiMsg(x) ("") #endif // PRODUCTION #include "targetver.h" #include "version.h" // Enable "unsafe", but much faster string functions #define _CRT_SECURE_NO_WARNINGS #define _SCL

Sharing precompiled headers between projects in Visual Studio

≡放荡痞女 提交于 2019-11-26 22:20:23
问题 I have a solution with many Visual C++ projects, all using PCH, but some have particular compiler switches turned on for project-specific needs. Most of these projects share the same set of headers in their respective stdafx.h (STL, boost, etc). I'm wondering if it's possible to share PCH between projects, so that instead of compiling every PCH per-project I could maybe have one common PCH that most projects in the solution could just use. It seems possible to specify the location of the PCH

Unexpected end of file error

独自空忆成欢 提交于 2019-11-26 20:05:06
问题 I hope you can help me, cause I have no idea about what's going on. I'm having the following error while trying to add Beecrypt library to my project: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? Actually I did not forget to add #include "stdafx" to my source. The compiler points the error to be at the end of this .cxx file: #define BEECRYPT_CXX_DLL_EXPORT #ifdef HAVE_CONFIG_H # include "config.h"

How to fix .pch file missing on build?

一个人想着一个人 提交于 2019-11-26 12:34:55
问题 When I build my c++ solution in Visual Studio it complains that the xxxxx.pch file is missing. Is there a setting I am missing to get the pre-compiled headers back? here is the exact error for completeness: Error 1 fatal error C1083: Cannot open precompiled header file: \'Debug\\xxxxx.pch\': No such file or directory 回答1: NOTE: Later versions of the IDE may use "pch" rather than "stdafx" in the default names for related files. It may be necessary to substitute pch for stdafx in the

Precompiled headers with GCC

℡╲_俬逩灬. 提交于 2019-11-26 10:09:15
问题 Anyone had any success getting precompiled headers working with GCC? I have had no luck in my attempts and I haven\'t seen many good examples for how to set it up. I\'ve tried on cygwin gcc 3.4.4 and using 4.0 on Ubuntu. 回答1: I have definitely had success. First, I used the following code: #include <boost/xpressive/xpressive.hpp> #include <iostream> using namespace std; using namespace boost::xpressive; //A simple regex test int main() { std::string hello( "hello world!" ); sregex rex =

Precompiled Headers

风格不统一 提交于 2019-11-26 09:26:11
问题 I have a sample project (not mine) which is in Visual C++ 6. I\'m trying to convert it to Visual Studio 2008. The older project is using precompiled headers. Now the questions are: What are precompiled headers? Since the older project is using precompiled headers. I\'ll also use them in Visual Studio 2008 (the new project). But I get errors saying that \"Did you forget to include stdafx.h\" , to remedy the problem, I include \"stdafx.h\" in every source file. That worked perfectly. But the

GCC and Precompiled Headers

99封情书 提交于 2019-11-26 03:23:15
问题 After reading this nice article (The Care and Feeding of Pre-Compiled Headers), I have some doubts regarding how these can actually work in real life. More specifically, how can I know that I need to trigger the rebuild of the pre-compiled header in the following scenarios: I decide to #define something in one of my .cpp files that alters the way the pre-processor interprets some headers that are already included in my pre-compiled header I include another header in one of my .cpp files which