473,796 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Precompiled Headers when building Static Library

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 requirement by LINK.EXE that if
an object file has used precompiled headers, then the resulting "precompile d
header object file" must also be one of the objects in the link.

(Whilst it does not affect my problem - I would dearly like to know why this
requirement exists? I thought a precompiled header was simply a pre-parsed
representation of the header...)

My problem is that much of our project is compiled into static libraries
which are then linked by multiple targets within the project.

I find that I cannot link with the static library unless I also link with
the precompiled header object file that was involved in the compile of those
objects in the static library (we have a separate precompiled header per
target in case compile options differ between targets). Interestingly, I
tried putting the precompiled header object file into the library but the
linker will not resolve it from there.

Is this behaviour correct? It seems ludicrous that if I were selling a
static library how on earth would I ship it to customers? With the
precompiled object file separate? Or would I have to forego the benefits of
using precompiled headers?

I could of course be entirely wrong about all of this, so if that's the case
I would appreciate being informed as to what I am doing wrong and how to
correct it.

Kevin.

Nov 17 '05 #1
3 1926
"Kevin Frey" <ke**********@h otmail.com> wrote in message
news:OQ******** *******@TK2MSFT NGP12.phx.gbl.. .
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.
It's been available since 10/28 if you're an MSDN subscriber, and since 11/7
for everyone else.
The most onerous problem so far concerns the requirement by LINK.EXE that
if an object file has used precompiled headers, then the resulting
"precompile d header object file" must also be one of the objects in the
link.

(Whilst it does not affect my problem - I would dearly like to know why
this requirement exists? I thought a precompiled header was simply a
pre-parsed representation of the header...)
I believe that it's so the linker can merge the symbol tables from the
PCH-builder into the PDB of the resulting image. Without it, all symbols
defined in the PCH would be missing from the PDB.
My problem is that much of our project is compiled into static libraries
which are then linked by multiple targets within the project.

I find that I cannot link with the static library unless I also link with
the precompiled header object file that was involved in the compile of
those objects in the static library (we have a separate precompiled header
per target in case compile options differ between targets). Interestingly,
I tried putting the precompiled header object file into the library but
the linker will not resolve it from there.

Is this behaviour correct? It seems ludicrous that if I were selling a
static library how on earth would I ship it to customers? With the
precompiled object file separate? Or would I have to forego the benefits
of using precompiled headers?

I could of course be entirely wrong about all of this, so if that's the
case I would appreciate being informed as to what I am doing wrong and how
to correct it.


I've never encountered the problem you describe - but it doesn't sound right
to me either. Hopefully someone else can shed some more light.

-cd
Nov 17 '05 #2
> I've never encountered the problem you describe - but it doesn't sound right
to me either. Hopefully someone else can shed some more light.


Are you saying you've built projects involving multiple static
libraries that were compiled with different precompiled headers and
you've never run into problems? Or are you saying you've simply never
heard of anyone else having this problem?

Nov 17 '05 #3
ke**********@ho tmail.com wrote:
I've never encountered the problem you describe - but it doesn't
sound right to me either. Hopefully someone else can shed some more
light.


Are you saying you've built projects involving multiple static
libraries that were compiled with different precompiled headers and
you've never run into problems? Or are you saying you've simply never
heard of anyone else having this problem?


Both.

-cd
Nov 17 '05 #4

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

Similar topics

6
2190
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 the views of the experienced users of various C++ implementations? Do precompiled headers allow pimpls to be avoided while maintaining the same speed up of development time?
1
3661
by: JoeS | last post by:
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...
4
2517
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 usage of a large third party library which means after pre-processing each translation unit is around 1meg in size. There are reasons though why I cannot use the standard approach to precompiled headers. What I would like to do is somthing like...
0
1221
by: Bruno van Dooren | last post by:
Hi, I am working on a dll that exports COM interfaces, and i am having some troubles with the use of precompiled headers. the project compiles always, but if i use /Yu (default: use precompiled header) i get linker error: OPCServer.exp : warning LNK4070: /OUT:OPCServer.dll directive in .EXP differs from output filename '.\Debug/CIT_OPC_Server.dll'; ignoring directive
20
1635
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 files to this project, that compile as hard raw C - not C++. The .c files obviously won't understand the <atlbase.h> etc that are in the stdafx.h. But if I leave the precompiled headers switch on, it complains that fatal end of file was found...
1
976
by: Bonj | last post by:
Is incremental linking AND precompiled headers at the same time not like overkill? What is incrementaly linking if it's not the same as precompiled headers?
0
1193
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 situation, if anyone has a clue as to how I can solve this, please let me know. I am using VS.NET 2003 Arch. I have a solution two projects, a library and an exe. The exe depends upon the library. Both build with /zi in
0
1943
by: simon.hudon | last post by:
Hi everyone, I have a strange problem with precompiled headers with VC8. I have the problem while trying to use a precompiled header to build another precompiled header. I tried the sample code provided on msdn for the use of /Yu /Yc and while it works well with VC++ 7.0, it doesn't with VC++ 8.0 (http://msdn2.microsoft.com/en-us/library/2yzw0wyd.aspx). It gives me this error under VC 8: level2.cpp(3) : fatal error C1083: Cannot...
8
1483
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 be any problem if I compile this code on other compilers? I'm asking this because when I use pch *some* of my cpp files has following as there first line #include "StdAfx.h"
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.