473,379 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Sharing precompiled headers between projects - Repost

Is there anyway to share a single pch file between
projects in VC 7.0? I have 300+ projects each of which
creates its own pch. All projects include the exact same
header files in the precompiled header. Its takes about 7
seconds to create the precompiled header for each project.
That's 35 minutes spent creating precompiled headers for
all project! All of the projects use PDB files for debug
info.

I tried creating Precomp.pch in project Precomp.vcproj.
When I tried using Precomp.pch in a project Foo.vcproj
using /Fp I get this error message:

c:\objd\Foo\vc70.pdb is not the pdb file that was used
when this precompiled header was created, recreate the
precompiled header."

In the pre-build step of Foo.vcproj I tried copying
c:\objd\Precomp\vc70.pdb to c:\objd\Foo\vc70.pdb but this
resulted in the same error message.

Any insight is much appreciated.

Thanks.
Joe

Nov 16 '05 #1
1 3636
Hi Joe,

I have tested your problem. Here are some steps to workaround the problem.
Below is my directory structure.
(Solution)Test-----test1 (project1)
|---------test2 (project2)
If you generate your applications with AppWizard, the STDAFX.H file is the
same in all applications and it is a good example file. Here I use it as an
example.

1. Create a new blank solution and add all projects into it.
2. Copy the header file into the desired common directory (here is Test
directory) and delete it from the project directories.
3. In each .CPP file that includes the common PCH file, specify a
fully-qualified path to the header file. Here I modified the code as below
#include "C:\Test\stdafx.h"
4. For each project, opens its Project Property Pages
1) Navigates to ¡°Configuration Properties¡± -> ¡°C/C++¡± -> ¡°Precompiled
Headers¡±.
i. Modifies the first option as Use Precompiled Header(/Yu) (You should
create the precompiled header first)
ii. Modifies the second option as $(SolutionDir)StdAfx.h
iii. Modifies the three option as $(SolutionDir)$(SolutionName).pch
2) Navigates to ¡°Configuration Properties¡± -> ¡°C/C++¡± -> ¡°Output Files¡
±
i. Modifies the fifth option as ¡°$(SolutionDir)vc70.pdb¡± (this is
used to ensure all projects refer to identical vc70.pdb file.
3) Clicks OK to save the setting.

At this point, future builds use the common PCH files, as desired.
Hope this help.
Regards,

Peter Huang
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "JoeS" <jo*******@joenospam.com>
Sender: "JoeS" <jo*******@joenospam.com>
Subject: Sharing precompiled headers between projects - Repost
Date: Tue, 8 Jul 2003 10:57:15 -0700
Lines: 26
Message-ID: <03****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcNFel22eGstb/h9T0GGuRJXA//Cug==
Newsgroups: microsoft.public.dotnet.languages.vc
Path: cpmsftngxa09.phx.gbl
Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.languages.vc:5271
NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
X-Tomcat-NG: microsoft.public.dotnet.languages.vc

Is there anyway to share a single pch file between
projects in VC 7.0? I have 300+ projects each of which
creates its own pch. All projects include the exact same
header files in the precompiled header. Its takes about 7
seconds to create the precompiled header for each project.
That's 35 minutes spent creating precompiled headers for
all project! All of the projects use PDB files for debug
info.

I tried creating Precomp.pch in project Precomp.vcproj.
When I tried using Precomp.pch in a project Foo.vcproj
using /Fp I get this error message:

c:\objd\Foo\vc70.pdb is not the pdb file that was used
when this precompiled header was created, recreate the
precompiled header."

In the pre-build step of Foo.vcproj I tried copying
c:\objd\Precomp\vc70.pdb to c:\objd\Foo\vc70.pdb but this
resulted in the same error message.

Any insight is much appreciated.

Thanks.
Joe


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Asfand Yar Qazi | last post by:
Hi, Now that GCC 3.4 has precompiled headers, I'm thinking I can stop using pimpls to speed up development time, as it may make life easier (declaring pimpls takes a long time...) What are...
4
by: Andrew Ward | last post by:
Hi All, I was wondering if it is possible to use precompiled headers without having to include a <stdafx.h> or whatever in every source file. My problem is that I have a project that makes heavy...
0
by: Daniel | last post by:
Hi! I have several projects (approx 50) that includes basically the same files such as <atlcom.h> and <comdef.h>. The projects are set up to use a precompiled header wich includes these header...
20
by: Bonj | last post by:
Is it possible to avoid using precompiled headers on files that don't #include "stdafx.h". I have an ATL project,which has got a lot of ATL #includes in its stdafx.h. I now need to add some .c...
2
by: Tommy Vercetti | last post by:
I am working on a Managed C++ project and I get the following error: TestThread.cpp(3) : error C2859: c:\projects\ProjectName\debug\vc70.pdb is not the pdb file that was used when this...
0
by: citizenkahn | last post by:
I read an article entitled "Sharing precompiled headers between projects" on this group. I am in the same situation as the requesting author, but the solution has not worked for me. Here is my...
3
by: Kevin Frey | last post by:
I am working on a test migration of our project to Visual Studio 2005 Beta 2 as a precursor to the availability of the full release of VS2005. The most onerous problem so far concerns the...
8
by: Abubakar | last post by:
Hi, I am writing some unmanaged c++ code that would need to be compiled in the future using compilers other than vc++. I'm using the feature of vc++ "use precompiled headers", is there going to...
11
by: gumboots | last post by:
Hi there guys, I've recently purchased "Sam's Teach Yourself C++ Fifth Edition" (About a week before the 6th edition came out) I'm trying to work through the book, but in trying to compile Hello...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.