precompiled-headers

Precompiled headers with GCC

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. ...

Using pre-compiled headers with CMake

I have seen a few (old) posts on the 'net about hacking together some support for pre-compiled headers in CMake. They all seem a bit all-over the place and everyone has their own way of doing it. What is the best way of doing it currently? ...

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

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 ...

Why does stdafx.h work the way it does?

Hi all.. As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :) This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things: Includes standard headers which we might (?) use and which are rarely changed Work as a compiler-bookmark for when ...

Are there cross-platform precompiled header frameworks/methods in C++?

I'm wondering what others have experienced implementing cross-platform (linux and windows) precompiled headers in C++. I'm thinking of what Visual Studio lets you do with stdafx.h files that can drastically improve compile times for large amounts of C++ code by precompiling the common headers used across the board (std/boost/etc headers)...

Sharing precompiled headers between projects in Visual Studio

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 e...

What to put in precompiled header? (MSVC)

What are the best candidates for a precompiled header file? Can I put STL and Boost headers there, even though they have templates? And will that reduce compile times? Also, what are the best IDE settings to reduce compile times? ...

Why use Precompiled Headers (C/C++)?

Hello all :) Quick question -- Why use Precompiled Headers? Billy3 EDIT: Reading the responses, I suspect what I've been doing with them is kinda 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 C1854: cannot overwrite information formed during creation of the precompiled header in object file

foo.cpp(33918) : fatal error C1854: cannot overwrite information formed during creation of the precompiled header in object file: 'c:\somepath\foo.obj' Consulting MSDN about this gives me the following information: You specified the /Yu (use precompiled header) option after specifying the /Yc (create precompiled header) option ...

Visual C++ Linking LNK2019 problem with Precompile Header

Hi all, I had a very weird problem with precompile header. The linker generates LNK2019: unresolved external symbol error when I implement method in .cpp file. However, the program could be compiled if I implement method in .h file. I happened to find out a solution but I have no idea about the root cause of this error. My project str...

SCons, Boost::ASIO, Windows Precompiled Headers, and Linker Errors

I'm investigating using SCons for our build process as we develop C++ for multiple platforms. I'm 99% of the way there in the build configuration, but I'm running into a VERY strange error on Windows having to do with the precompiled header file. Even stranger still is that it only happens on one project. In the SConscript file for th...

MSVC precompiled headers: Which files need to #include "stdafx.h"?

Does every file need to #include "stdafx.h" when using precompiled headers? Or do only source files need to include it. EDIT: Also, my precompiled header file #includes a lot of STL headers. But, in my headers, I sometimes have functions that return std::vector or something like that, so I need to #include <vector> anyway. Is this worse...

restructuring dependencies of some files in a project using precompiled headers causes linker errors

I'm using MSVC++ 6 to build a very large project. Some of the source files in this project are shared with a small utility that we use for maintaining the application. Previously, this small utility required linking against many libs from the main app and also required the main app's DLLs at runtime. I was tasked with removing these d...

C++ / CLI Precompiled Headers: How do they work?

I'm trying to write a mixed-mode DLL, let's call it 'Client', to replace some unmanaged classes with their managed equivalents. Everything works fine on my personal machine, but when I check the source code in, our build machine won't build the project. It doesn't recognize the Managed classes I'm using from another DLL, called 'Core.' ...

Precompiled Headers? Do we really need them

Hello All, Back a long time ago I used to use pre-compiled headers: a. to speed compilation and b. because I supported multiple development tools like CodeWarrior, MPW, VS, ProjectBuilder, gcc, intel compilers, etc, etc. Now I have a Mac Pro with 32gb of RAM. Now I use just CMake. So do we really need pre-compiled headers anymore? ...

Small question about precompiled headers

Looking at an open source code base i came across this code: #include "StableHeaders.h" #include "polygon.h" #include "exception.h" #include "vector.h" ... Now the StableHeaders.h is a precompiled header which is included by a 'control' cpp to force it's generation. The three includes that appear after the precompiled header are also ...

Precompiled Headers

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 er...

Question about precompiled headers in Visual C++

If I put a header (a.h) into stdafx.h and that header includes another header (b.h) that is not mentioned in stdafx.h, will b.h be visited every time someone includes a.h or is it compiled in as part of a.h? If it is compiled into a.h, what happens when someone includes b.h directly? Will this be precompiled or not? My motivation for ...

What are the pros & cons of pre-compiled headers specifically in a GNU/Linux environment/tool-chain?

Pre-compiled headers seem like they can save a lot of time in large projects, but also seem to be a pain-in-the-ass that have some gotchas. What are the pros & cons of using pre-compiled headers, and specifically as it pertains to using them in a Gnu/gcc/Linux environment? ...

targeting iPhoneOS 2.2.1

I don't believe that I am using any 3.0 specific APIs, but somehow whenever I compile I get a warning "This project uses features only available in iPhone SDK 3.0 and later", and then a bunch of errors. If I change the Base SDK to 3.0, the warning & errors go away, but then of course I cannot target OS 2.2.1 I see that this is coming...