LNK2022 Fehler Bei der Verwendung von /clr

Ich habe ein problem mit dem verknüpfen eines C++ - Projekt in VS2008 bei der Verwendung der /clr compile-option. Ich erhalte die folgende build-Fehler:

Class1.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046f).
Class1.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000473).
Class2.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046f).
Class2.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000473).
Class3.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046e).
Class3.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000472).
Class4.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046e).
Class4.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000472).
Class5.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046e).
Class5.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000472).
Class6.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEA): (0x0200046e).
Class6.obj : error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (_PROPSHEETPAGEW): (0x02000472).
LINK : fatal error LNK1255: link failed because of metadata errors

Ich habe keine Ahnung, was PROPSHEETPAGEA und PROPSHEETPAGEW bezogen werden. Ich online überprüft, um zu sehen, Microsoft ' s Beschreibung der Fehler, aber ich bin an einem Verlust, was es bedeutet.
http://support.microsoft.com/kb/324088

Um dieses problem zu beheben, hinzufügen von eindeutigen Kennungen, wenn Sie Managed Extensions für C++, so dass Sie vermeiden Sie die Verwendung von anonymen Strukturen als Globale Variablen.

Microsoft hat bestätigt, dass dies einen Fehler in Microsoft-Produkten, die aufgeführt sind zu Beginn dieses Artikels. Dieser Fehler wurde behoben in Microsoft Visual C++ .NET (2003).

Irgendwelche Ideen würde sehr geschätzt werden.

BEARBEITEN

Nachdem ich ein ildasm auf Class1.obj ich extrahierten zwei Nachrichten:

//TypeDef #1134 (0200046f)
//-------------------------------------------------------
// TypDefName: _PROPSHEETPAGEA  (0200046F)
// Flags     : [NotPublic] [SequentialLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit]  (00100108)
// Extends   : 0100000B [TypeRef] System.ValueType
// Layout    : Packing:0, Size:56
// CustomAttribute #1 (0c0012a0)
// -------------------------------------------------------
//     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 #2 (0c0012a1)
// -------------------------------------------------------
//     CustomAttribute Type: 0a000001
//     CustomAttributeName: Microsoft.VisualC.DebugInfoInPDBAttribute :: instance void .ctor()
//     Length: 4
//     Value : 01 00 00 00                                      >                <
//     ctor args: ()
//
// CustomAttribute #3 (0c0012a2)
// -------------------------------------------------------
//     CustomAttribute Type: 0a000004
//     CustomAttributeName: System.Runtime.CompilerServices.NativeCppClassAttribute :: instance void .ctor()
//     Length: 4
//     Value : 01 00 00 00                                      >                <
//     ctor args: ()


//TypeDef #1138 (02000473)
//-------------------------------------------------------
// TypDefName: _PROPSHEETPAGEW  (02000473)
// Flags     : [NotPublic] [SequentialLayout] [Class] [Sealed] [AnsiClass] [BeforeFieldInit]  (00100108)
// Extends   : 0100000B [TypeRef] System.ValueType
// Layout    : Packing:0, Size:56
// CustomAttribute #1 (0c0012b0)
// -------------------------------------------------------
//     CustomAttribute Type: 0a000004
//     CustomAttributeName: System.Runtime.CompilerServices.NativeCppClassAttribute :: instance void .ctor()
//     Length: 4
//     Value : 01 00 00 00                                      >                <
//     ctor args: ()
//
// CustomAttribute #2 (0c0012b1)
// -------------------------------------------------------
//     CustomAttribute Type: 0a000001
//     CustomAttributeName: Microsoft.VisualC.DebugInfoInPDBAttribute :: instance void .ctor()
//     Length: 4
//     Value : 01 00 00 00                                      >                <
//     ctor args: ()
//
// CustomAttribute #3 (0c0012b2)
// -------------------------------------------------------
//     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)

Ich bin mir nicht sicher, was das alles bedeutet, aber es sieht aus, als wenn der zweite Eintrag ist identisch mit dem ersten, mit Ausnahme der Attribute, die definiert wird rückwärts.

  • Ich meine modifizierten Aufbau der Lösung zu house alle verwalteten code in einem einzelnen Projekt anstelle von mehreren Projekten, und der Fehler ist verschwunden. Es wird für immer ein Geheimnis...
InformationsquelleAutor lumberjack4 | 2010-10-11
Schreibe einen Kommentar