Discussion:
VC 6 to VC 9 conversion Linker Issue
(too old to reply)
Hemanth71279
2009-11-10 08:44:33 UTC
Permalink
Hi,

I've a project which has been converted from VC6 to VC9. Here's my
problem. While building this project, it throws a linker error
complaining that it cannot open MFC42.lib; I understand that it's
trying to locate MFC42.lib instead of MFC90.lib; So, what I suspect is
that one of the additional dependencies must've been built using VC6
(which links to MFC42.lib). The project's additional dependencies list
a bunch of libraries which include other project libraries and third
party libraries.

Here's my requirement:

Is there some way for me to figure out which of these (additional)
libraries is trying to use MFC42.lib? I've already tried /VERBOSE:LIB
and /VERBOSE linker options. The former option lists out the libraries
as they're searched but does not indicate which library includes a
particular library (MFC42.lib in our case). The latter option gives
more information but nothing close to what I'm looking for.

I'm looking for LINKER option like /showincludes (COMPILER option)
which prints to the output, a tree-like hierarchy when including the
headerfile(s) .

One more query:

when using /VERBOSE, I came across the following output line which
reads something like:
processing /DEFAULTLIB:<xyz.lib>

In my case the <xyz.lib> is a project library; not a SDK library or VC
library. I want to know which option governs this behaviour? I know
that we can ignore a default library using the linker option /
NODEFAULTLIB:<library>. But what I don't know is that why certain
library is included as a default library (of course, I need not assert
here that this is not included in additional dependencies).
Ulrich Eckhardt
2009-11-10 09:09:29 UTC
Permalink
Post by Hemanth71279
when using /VERBOSE, I came across the following output line which
processing /DEFAULTLIB:<xyz.lib>
In my case the <xyz.lib> is a project library; not a SDK library or VC
library. I want to know which option governs this behaviour?
Using "#pragma comment(lib, ..)" in C[++], you can embed information for the
linker in an objectfile. This then creates exactly the
above "/DEFAULTLIB:.." lines when linking verbosely.
Post by Hemanth71279
But what I don't know is that why certain library is included as a
default library (of course, I need not assert here that this is not
included in additional dependencies).
The wording in "default lib" is a bad choice by the implementers of the
system, IMHO. Don't put too much meaning into the "default".

Concerning your problem about the reference to old MFCs, you will get that
if you have any object files or static libs (which are glorified
collections of object files) that were compiled against the old MFC
headers. Make sure to clean up your sources and also that any dependencies
are recompiled.

Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Carl Daniel [VC++ MVP]
2009-11-10 14:33:42 UTC
Permalink
Post by Hemanth71279
Is there some way for me to figure out which of these (additional)
libraries is trying to use MFC42.lib? I've already tried /VERBOSE:LIB
and /VERBOSE linker options. The former option lists out the libraries
as they're searched but does not indicate which library includes a
particular library (MFC42.lib in our case). The latter option gives
more information but nothing close to what I'm looking for.
You want /VERBOSE. Capture the output into a text file and search it for
MFC42. When you find it, read the few lines above that point and you'll
know which module is (first) to try to pull in MFC42. You will be looking
for a /DEFAULTLIB directive that's embedded inside an object file.

-cd

Loading...