473,616 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS7.1 to VS 8 : MSVCMRTD.lib(ms tartup.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\d ebug\XWRAP70.li b and object
\sda\Main\bin\d ebug\XWRAP70.ex p
MSVCMRTD.lib(ms tartup.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA ): (0x02000039).
MSVCMRTD.lib(me hvecdtr.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA ): (0x0200002a).
MSVCMRTD.lib(ma nagdeh.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA ): (0x02000029).
MSVCMRTD.lib(ms ilexit.obj) : error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA ): (0x0200002f).
MSVCMRTD.lib(pu remsilcode.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 4473
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\d ebug\XWRAP70.li b and object
\sda\Main\bin\d ebug\XWRAP70.ex p
MSVCMRTD.lib(ms tartup.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*********@no spam.nospam"
<co*********@no spam.nospam@dis cussions.micros oft.com> 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\d ebug\XWRAP70.li b and object
\sda\Main\bin\d ebug\XWRAP70.ex p
MSVCMRTD.lib(ms tartup.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_DECLAR E_FIX -DNO_PL -DNO_ITEM_HIER -DINCLUDE_XPERTS
-DIN_XACTWRAP_DL L -DDEBUG -Od -Zi xwmain.cpp > xwmain.drr

Here is the command line for link.exe:
link -debug -OPT:NOWIN98 /CLRIMAGETYPE:IJ W /CLRTHREADATTRIB UTE:MTA -nologo
/DLL
-subsystem:windo ws,4.0 -OUT:\sda\Main\b in\debug\XWRAP7 0.DLL /MACHINE:IX86
/BASE:
0x44000000 /INCREMENTAL:NO ..\xacttool\deb ug\xttoolbr.obj
...\xactcore\de bug\clis
tptr.obj ..\xactcore\deb ug\compitem.obj ..\xactcore\deb ug\complist.obj
...\xactco
re\debug\debug. obj ..\xactcore\deb ug\pcharutl.obj ..\xactcore\deb ug\r64.obj
...\x
actcore\debug\s trcvt.obj ..\xactcore\deb ug\strgbl.obj
...\xactcore\de bug\strings.
obj ..\xactcore\deb ug\time.obj ..\xactcore\deb ug\timegbl.obj
...\xactcore\de bug\t
ree.obj ..\xactcore\deb ug\vector.obj ..\xactcore\deb ug\xbase.obj
...\xactcore\de b
ug\xcblob.obj ..\xactcore\deb ug\xcerror.obj ..\xactcore\deb ug\xcfile.obj
...\xact
core\debug\xcfi lesy.obj ..\xactcore\deb ug\xcfdelim.obj
...\xactcore\de bug\xclk.ob
j ..\xactcore\deb ug\xcmark.obj ..\xactcore\deb ug\xcmemo.obj
...\xactcore\de bug\xc
mutex.obj ..\xactcore\deb ug\xcompres.obj ..\xactcore\deb ug\xcstorage.ob j
...\xact
core\debug\xcst ream.obj ..\xactcore\deb ug\xctextvld.ob j
...\xactcore\de bug\xcvari
an.obj ..\xactcore\deb ug\xcvartyp.obj ..\xactcore\deb ug\xczip.obj
...\xactcore\de
bug\xczipstg.ob j ..\xactcore\deb ug\xczipstg_xc. obj
...\xactcore\de bug\xczipstg_zp
..obj ..\xactcore\deb ug\xstack.obj debug\imgapi.ob j debug\wevent.ob j
debug\xwanim
at.obj debug\xwcompedi t.obj debug\xwimglst. obj debug\xwlistvw. obj
debug\xwlvitem
..obj debug\xwmhook.o bj debug\xwmsghk.o bj debug\xwprogbr. obj
debug\xwspiner. obj d
ebug\xwstatus.o bj debug\xwtooltp. obj debug\xwtreevw. obj debug\xwtritem. obj
debug
\xwudctrl.obj debug\xwwait.ob j 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.o bj debug\xwdispla. obj debug\xwedit.ob j debug\xwenhdsp. obj
debug\x
wevent.obj debug\xwfont.ob j debug\xwfontme. obj debug\xwgraphi. obj
debug\xwimage.
obj debug\xwimgwin. obj debug\xwkhook.o bj debug\xwlists.o bj
debug\xwmemdis. obj de
bug\xwmenu.obj debug\xwmetdsp. obj debug\xwmodule. obj debug\xwnetwrk. obj
debug\xw
ole.obj debug\xwole1.ob j debug\xwoleclp. obj debug\xwoledat. obj
debug\xwpalett. ob
j debug\xwpoint.o bj debug\xwprint.o bj 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.o bj debug\xwwin.obj
debug\xwwininf. obj
debug\xwwinobj. obj debug\xwmenubar .obj debug\xwmsgflth k.obj debug\xwapp.obj
deb
ug\xwdockfr.obj debug\xwgbox.ob j debug\xwimagewr it.obj
...\themewrap\d ebug\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_dll 32.lib \sda\Main\bin\d ebug\implodei.l ib 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\d ebug\XWRAP70.li b and object
\sda\Main\bin\d ebug\XWRAP70.ex p
MSVCMRTD.lib(ms tartup.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*********@no spam.nospam"
<co************ *********@discu ssions.microsof t.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] [SequentialLayou t] [Class] [Sealed] [AnsiClass]
[BeforeFieldInit] (00100108)
// Extends : 0100000E [TypeRef] System.ValueTyp e
// Layout : Packing:0, Size:56
// CustomAttribute #1 (0c000096)
// -------------------------------------------------------
// CustomAttribute Type: 0a000001
// CustomAttribute Name: Microsoft.Visua lC.DebugInfoInP DBAttribute ::
instance void .ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()
//
// CustomAttribute #2 (0c000097)
// -------------------------------------------------------
// CustomAttribute Type: 0a000002
// CustomAttribute Name: Microsoft.Visua lC.Miscellaneou sBitsAttribute ::
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
// CustomAttribute Name:
System.Runtime. CompilerService s.NativeCppClas sAttribute :: 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] [SequentialLayou t] [Class] [Sealed] [AnsiClass]
[BeforeFieldInit] (00100108)
// Extends : 0100000B [TypeRef] System.ValueTyp e
// Layout : Packing:0, Size:53
// CustomAttribute #1 (0c0000cf)
// -------------------------------------------------------
// CustomAttribute Type: 0a000001
// CustomAttribute Name: Microsoft.Visua lC.DebugInfoInP DBAttribute ::
instance void .ctor()
// Length: 4
// Value : 01 00 00 00 >
<
// ctor args: ()
//
// CustomAttribute #2 (0c0000d0)
// -------------------------------------------------------
// CustomAttribute Type: 0a000003
// CustomAttribute Name: Microsoft.Visua lC.Miscellaneou sBitsAttribute ::
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
// CustomAttribute Name:
System.Runtime. CompilerService s.NativeCppClas sAttribute :: 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*********@no spam.nospam"
<co************ *********@discu ssions.microsof t.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(alig n) 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
4367
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 files containing some templates: adjacency_list.hpp and mem_fn.hpp can not compile. Does anyone have any solutions?
1
4890
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 some math routines ... comes out to about 19 megs created a dll of the same math routines came out to 600 kb I take it I have to keep the obj files around (to go with the dll) and
2
446
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 this to a dll. The files that were supplied to me by are : a .lib file a .h file a .dll
0
5234
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 complied MT - looks like yet another VS.Net bug?? (YAVS.NB) .. .. ..
6
3443
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 "C"' so that a cross-compiler-usage must be possible. I created an import library (.lib) for MSVC by using the LIB function and using a .DEF file (as described in KB131313 -
0
2754
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 developing is a mixed mode Managed wrapper dll. I have written a class to encapsulate the unmanaged code. I have also created a managed wrapper class that uses the unmanaged class
1
7897
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. LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in atlmincrt.lib(atlinit.obj) LIBCMT.lib(tidtable.obj) : error LNK2005: __encoded_null already defined in atlmincrt.lib(atlinit.obj)
2
5314
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: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
2
6976
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: parseMetadata.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) 2>libcpmt.lib(string.obj) : error LNK2001: unresolved external symbol "public: __thiscall...
0
8203
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8146
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8592
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5550
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
4063
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
4141
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2579
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
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.