469,299 Members | 2,050 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,299 developers. It's quick & easy.

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 3469
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Asfand Yar Qazi | last post: by
4 posts views Thread by Andrew Ward | last post: by
20 posts views Thread by Bonj | last post: by
8 posts views Thread by Abubakar | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.