473,383 Members | 1,818 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,383 software developers and data experts.

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 "precompiled
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 1904
"Kevin Frey" <ke**********@hotmail.com> wrote in message
news:OQ***************@TK2MSFTNGP12.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
"precompiled 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**********@hotmail.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
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...
1
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...
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: 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...
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...
1
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
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...
0
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...
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.