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

VS7.1 to VS 8 : MSVCMRTD.lib(mstartup.obj) : LNK2022 : tagTEXTMETR

I am trying to upgrade from VS7.1 to VS8, but whenever I link any of our MC++
DLL's, I get the following errors:

Creating library \sda\Main\bin\debug\XWRAP70.lib and object
\sda\Main\bin\debug\XWRAP70.exp
MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000039).
MSVCMRTD.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x0200002a).
MSVCMRTD.lib(managdeh.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000029).
MSVCMRTD.lib(msilexit.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x0200002f).
MSVCMRTD.lib(puremsilcode.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000029).
LINK : fatal error LNK1255: link failed because of metadata errors

Any ideas on what I need to change to eliminate these?

Thanks,
Nov 17 '05 #1
8 4447
Hi consultutah!
I am trying to upgrade from VS7.1 to VS8, but whenever I link any of our MC++
DLL's, I get the following errors:

Creating library \sda\Main\bin\debug\XWRAP70.lib and object
\sda\Main\bin\debug\XWRAP70.exp
MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000039).


Are you sure that you have compiled with the same settings for CLR?
(/clr:oldsyntax) ?

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #2
"co*********@nospam.nospam"
<co*********@nospam.nospam@discussions.microsoft.c om> wrote
I am trying to upgrade from VS7.1 to VS8, but whenever I link any of our
MC++
DLL's, I get the following errors:

Creating library \sda\Main\bin\debug\XWRAP70.lib and object
\sda\Main\bin\debug\XWRAP70.exp
MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types [..] LINK : fatal error LNK1255: link failed because of metadata errors

Any ideas on what I need to change to eliminate these?

Use the same settings and defines as were used to compile the
other files (the information is embedded in the object files).
This one actually looks like a VC bug.

BTW: You can always use ildasm /OUT on the object files
(you might need another switch for numerical token values
(/TOKENS ?) ). Lib can extract objects from archives.

-hg
Nov 17 '05 #3
I'm sorry, I don't understand.

I am using the same cl and link options for every file. We have one common
makefile.mif that gets included by all other makefiles. That way, there is
only one place to change the options.

Here is the command line for cl.exe (though I'm pretty sure that the real
problem is the linker):

cl -c -Fddebug\ -Fodebug\ -WX -Gd -Zp1 -nologo -vmg -Gs -D_WIN95 -DWIN32
-DWINVER=0x0400 -W3 -MDd /clr:oldSyntax -wd 4562 -wd 4835 -wd 4996 -wd 4793
-DVS2005 -DFORWARD_DECLARE_FIX -DNO_PL -DNO_ITEM_HIER -DINCLUDE_XPERTS
-DIN_XACTWRAP_DLL -DDEBUG -Od -Zi xwmain.cpp > xwmain.drr

Here is the command line for link.exe:
link -debug -OPT:NOWIN98 /CLRIMAGETYPE:IJW /CLRTHREADATTRIBUTE:MTA -nologo
/DLL
-subsystem:windows,4.0 -OUT:\sda\Main\bin\debug\XWRAP70.DLL /MACHINE:IX86
/BASE:
0x44000000 /INCREMENTAL:NO ..\xacttool\debug\xttoolbr.obj
...\xactcore\debug\clis
tptr.obj ..\xactcore\debug\compitem.obj ..\xactcore\debug\complist.obj
...\xactco
re\debug\debug.obj ..\xactcore\debug\pcharutl.obj ..\xactcore\debug\r64.obj
...\x
actcore\debug\strcvt.obj ..\xactcore\debug\strgbl.obj
...\xactcore\debug\strings.
obj ..\xactcore\debug\time.obj ..\xactcore\debug\timegbl.obj
...\xactcore\debug\t
ree.obj ..\xactcore\debug\vector.obj ..\xactcore\debug\xbase.obj
...\xactcore\deb
ug\xcblob.obj ..\xactcore\debug\xcerror.obj ..\xactcore\debug\xcfile.obj
...\xact
core\debug\xcfilesy.obj ..\xactcore\debug\xcfdelim.obj
...\xactcore\debug\xclk.ob
j ..\xactcore\debug\xcmark.obj ..\xactcore\debug\xcmemo.obj
...\xactcore\debug\xc
mutex.obj ..\xactcore\debug\xcompres.obj ..\xactcore\debug\xcstorage.obj
...\xact
core\debug\xcstream.obj ..\xactcore\debug\xctextvld.obj
...\xactcore\debug\xcvari
an.obj ..\xactcore\debug\xcvartyp.obj ..\xactcore\debug\xczip.obj
...\xactcore\de
bug\xczipstg.obj ..\xactcore\debug\xczipstg_xc.obj
...\xactcore\debug\xczipstg_zp
..obj ..\xactcore\debug\xstack.obj debug\imgapi.obj debug\wevent.obj
debug\xwanim
at.obj debug\xwcompedit.obj debug\xwimglst.obj debug\xwlistvw.obj
debug\xwlvitem
..obj debug\xwmhook.obj debug\xwmsghk.obj debug\xwprogbr.obj
debug\xwspiner.obj d
ebug\xwstatus.obj debug\xwtooltp.obj debug\xwtreevw.obj debug\xwtritem.obj
debug
\xwudctrl.obj debug\xwwait.obj debug\xwwtdisp.obj debug\xwrap_mn.obj
debug\xdlli
nit.obj debug\xwrap_cm.obj debug\datacach.obj debug\xwbitdat.obj
debug\xwbrush.o
bj debug\xwbutton.obj debug\xwclipbd.obj debug\xwcontrl.obj
debug\xwcstruc.obj d
ebug\xwdialog.obj debug\xwdispla.obj debug\xwedit.obj debug\xwenhdsp.obj
debug\x
wevent.obj debug\xwfont.obj debug\xwfontme.obj debug\xwgraphi.obj
debug\xwimage.
obj debug\xwimgwin.obj debug\xwkhook.obj debug\xwlists.obj
debug\xwmemdis.obj de
bug\xwmenu.obj debug\xwmetdsp.obj debug\xwmodule.obj debug\xwnetwrk.obj
debug\xw
ole.obj debug\xwole1.obj debug\xwoleclp.obj debug\xwoledat.obj
debug\xwpalett.ob
j debug\xwpoint.obj debug\xwprint.obj debug\xwprtdis.obj debug\xwprtdlg.obj
debu
g\xwrect.obj debug\xwregion.obj debug\xwregist.obj debug\xwscroll.obj
debug\xwst
atic.obj debug\xwsystem.obj debug\xwtable.obj debug\xwwin.obj
debug\xwwininf.obj
debug\xwwinobj.obj debug\xwmenubar.obj debug\xwmsgflthk.obj debug\xwapp.obj
deb
ug\xwdockfr.obj debug\xwgbox.obj debug\xwimagewrit.obj
...\themewrap\debug\xpthem
e.obj ..\config\debug\CONFIG.OBJ ..\config\debug\CONFIGC.OBJ kernel32.lib
advapi
32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib comctl32.lib ole32.lib
uui
d.lib vfw32.lib oledlg.lib winmm.lib oleaut32.lib mpr.lib version.lib
\sda\Main\
bin\debug\x_dll32.lib \sda\Main\bin\debug\implodei.lib debug\xactwrap.res
/NOENT
RY
Nov 17 '05 #4
Yes. I replaced the /clr option in our common makefile with the new
/clr:oldSyntax option.
"Jochen Kalmbach [MVP]" wrote:
Hi consultutah!
I am trying to upgrade from VS7.1 to VS8, but whenever I link any of our MC++
DLL's, I get the following errors:

Creating library \sda\Main\bin\debug\XWRAP70.lib and object
\sda\Main\bin\debug\XWRAP70.exp
MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000039).


Are you sure that you have compiled with the same settings for CLR?
(/clr:oldsyntax) ?

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #5
"co*********@nospam.nospam"
<co*********************@discussions.microsoft.com > wrote
I'm sorry, I don't understand.

It's just a poor diagnostic (It doesn't tell you where the other definition
is).

I think what happens is that you use tagTEXTMETRICA in your
code with a different definition than was used to build the CRT libs.

The compiler translates every native type into a CLR value type.
The linker does a merge of the assembly fragments. In your
case there are duplicate CLR TypeDefs which are not identical.

I'm not sure, however, as to why the CRT modules have a
definition for tagTEXTMETRICA at all. I fail to see a reason
why the CRT would use it. I also don't see why it should be
different in different object files (AFAICT it doesn't depend
on WINVER or things like that).

I don't see anything wrong in the command lines.

I'd suggest you run ildasm /OUT on the object files
contributing to the final image.
E.g.
FOR %f IN (*.obj) DO ildasm /OUT=%f.il %f
and extract one of the object files from msvcrtmd.lib
(you can use LIB /EXTRACT to do so)

Find the definition for tagTEXTMETRICA in
your object files and compare it to the one from
the CRT.

BTW: Which version are you using? It looks odd that
the CRT has these definitions.

-hg
Nov 17 '05 #6
I'm using version 8 (.NET 2.0).

You were right, this does show the difference:

From MSVCMRTD.lib:
// TypDefName: tagTEXTMETRICA (02000028)
// Flags : [NotPublic] [SequentialLayout] [Class] [Sealed] [AnsiClass]
[BeforeFieldInit] (00100108)
// Extends : 0100000E [TypeRef] System.ValueType
// Layout : Packing:0, Size:56
// CustomAttribute #1 (0c000096)
// -------------------------------------------------------
// CustomAttribute Type: 0a000001
// CustomAttributeName: Microsoft.VisualC.DebugInfoInPDBAttribute ::
instance void .ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()
//
// CustomAttribute #2 (0c000097)
// -------------------------------------------------------
// CustomAttribute Type: 0a000002
// CustomAttributeName: Microsoft.VisualC.MiscellaneousBitsAttribute ::
instance void .ctor(int32)
// Length: 8
// Value : 01 00 41 00 00 00 00 00 > A
<
// ctor args: (65)
//
// CustomAttribute #3 (0c000098)
// -------------------------------------------------------
// CustomAttribute Type: 0a000003
// CustomAttributeName:
System.Runtime.CompilerServices.NativeCppClassAttr ibute :: instance void
..ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()

From my obj - (I've limited it down to 1):
// TypDefName: tagTEXTMETRICA (02000030)
// Flags : [NotPublic] [SequentialLayout] [Class] [Sealed] [AnsiClass]
[BeforeFieldInit] (00100108)
// Extends : 0100000B [TypeRef] System.ValueType
// Layout : Packing:0, Size:53
// CustomAttribute #1 (0c0000cf)
// -------------------------------------------------------
// CustomAttribute Type: 0a000001
// CustomAttributeName: Microsoft.VisualC.DebugInfoInPDBAttribute ::
instance void .ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()
//
// CustomAttribute #2 (0c0000d0)
// -------------------------------------------------------
// CustomAttribute Type: 0a000003
// CustomAttributeName: Microsoft.VisualC.MiscellaneousBitsAttribute ::
instance void .ctor(int32)
// Length: 8
// Value : 01 00 41 00 00 00 00 00 > A
<
// ctor args: (65)
//
// CustomAttribute #3 (0c0000d1)
// -------------------------------------------------------
// CustomAttribute Type: 0a000004
// CustomAttributeName:
System.Runtime.CompilerServices.NativeCppClassAttr ibute :: instance void
..ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()

Notice that the difference is the size! The library version is 56 bytes,
whereas the version that is in my dlls is 53 bytes! So, does that mean I
might be including the declaration of tagMETRICA from the VS7.1 headers
instead of the VS8 headers?

Thanks,

Nov 17 '05 #7
"co*********@nospam.nospam"
<co*********************@discussions.microsoft.com > wrote
I'm using version 8 (.NET 2.0).
Is that the RTM version? Or Beta 2?

[..] Notice that the difference is the size! The library version is 56 bytes,
whereas the version that is in my dlls is 53 bytes! So, does that mean I
might be including the declaration of tagMETRICA from the VS7.1 headers
instead of the VS8 headers?


Unlikely. The size should always be the same (after all both VS 7.1
and VS 8 generated executables should run on Windows ;-) )

It looks like you have a bad alignment for the Windows headers.
I'm not sure whether the Windows headers are supposed to be
resilient to bad alignment settings.

Looking at your compiler settings there is -Zp1 which is likely
the culprit. I suggest you remove the switch, and add a
#pragma pack _after_ including the windows headers.

Ideally you should stick to standard alignment in the long term
and use #pragma pack or __declspec(align) only where needed.

-hg
Nov 17 '05 #8
That was it. I will have to see why the packing was set at 1.... It does
seem odd.

But at very least you got me past that one!

Thanks,
Nov 17 '05 #9

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
1
by: tom | last post by:
Ok i realize some will scoff at this question ... but i've never created dlls b4. always static libs because generally i need speed in num theory/cryptographic uses. I created a static lib of...
2
by: Jacques | last post by:
Hello there I'm pretty new to C, so this is probably an elementary question.... I'm trying to write a simple c program that calls a function in a third party library. I would then like to link...
0
by: David F. | last post by:
Getting this message so turned on /VERBOSE - part of the output is below (the only reference to searching of libc.lib). This is for a multi-threaded application and AFAIK all my libs are...
6
by: Uli | last post by:
Hello, I'm trying to use a DLL (by static linking) which was compiled with Borland C++Builder (BCB) in Visual C++ (Visual-Studio 2003). All functions are declared with the directive 'extern...
0
by: jason.pirok | last post by:
I've been reading other groups related to this error and I'm only getting more confused. I'm still quite new to MC++ and I could use a swift kick in the right direction. The application I'm...
1
by: sethuganesh | last post by:
HI, i have ported vc++ 6.0 code to visual studio 2005. During batch build in debug mode i din't get any error.But if i build the same in release mode i am getting the following error. ...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
by: Darko Miletic | last post by:
Recently I wrote a dll in c++ and to simplify the distribution I decided to link with multithreaded static library (/MT or /MTd option). In debug everything works fine but in release I get this: ...
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: 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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.