EDN Admin
Well-known member
Ive got a C++ library and Im currently editing some types to call .net types.<br/>
I wrote some wrappers for the managed implementation which are called by unmanaged classes.
I have something like this:
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; // file MyClassOne.h
#ifndef __MyClassOne_H_
#define __MyClassOne_H_
<span style="color:Blue; class MyClassOne
{
<span style="color:Green; //...
};
#endif
<span style="color:Green; // file MyClassTwo.h
#ifndef __MyClassTwo_H_
#define __MyClassTwo_H_
#include <span style="color:#A31515; "MyClassOne.h"
<span style="color:Blue; class MyClassTwo : <span style="color:Blue; public MyClassOne
{
<span style="color:Green; //...
};
#endif
<span style="color:Green; // file MyClassThree.h
#ifndef __MyClassThree_H_
#define __MyClassThree_H_
#include <span style="color:#A31515; "MyClassOne.h"
<span style="color:Blue; class MyClassThree : <span style="color:Blue; public MyClassOne
{
<span style="color:Green; //...
};
#endif
[/code]
Everything compiles well, but after compiling the linker throws some errors:
<div style="color:Black;background-color:White; <pre>
Error 4 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxFrameWindow): (0x02000262). I:myPathMyClassThree.obj MyClassLib
Error 5 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxUIWindow): (0x0200026b). I:myPathMyClassThree.obj MyClassLib
Error 6 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxFrameWindow>): (0x0200032a). I:myPathMyClassThree.obj MyClassLib
Error 7 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxUIWindow>): (0x0200032b). I:myPathMyClassThree.obj MyClassLib
Error 8 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxFrameWindow): (0x02000261). I:myPathMyClassTwo.obj MyClassLib
Error 9 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxUIWindow): (0x0200026a). I:myPathMyClassTwo.obj MyClassLib
Error 10 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxFrameWindow>): (0x02000329). I:myPathMyClassTwo.obj MyClassLib
Error 11 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxUIWindow>): (0x0200032a). I:myPathMyClassTwo.obj MyClassLib
Error 12 error LNK1255: link failed because of metadata errors I:myPathLINK MyClassLib
[/code]
The interesting thing is, when I remove inheritance (so the #include "MyClassOne.h" in MyClassTwo and MyClassThree then the error disappears.<br/>
But I really need inheritance.
Btw: MyClassOne.cpp, MyClassTwo.cpp and MyClassThree.cpp are compiled using the /clr option.<br/>
MyClassOne.h, MyClassTwo.h and MyClassThree.h are also #included in other .h files that are included itself in other cpp files that are not compiled using /clr option.
If you need more information, just let me know.<br/>
Any idea?<br/>
<br/>
Thanks in advance <hr class="sig trust is a weakness, betrayal is the hidden blade
View the full article
I wrote some wrappers for the managed implementation which are called by unmanaged classes.
I have something like this:
<div style="color:Black;background-color:White; <pre>
<span style="color:Green; // file MyClassOne.h
#ifndef __MyClassOne_H_
#define __MyClassOne_H_
<span style="color:Blue; class MyClassOne
{
<span style="color:Green; //...
};
#endif
<span style="color:Green; // file MyClassTwo.h
#ifndef __MyClassTwo_H_
#define __MyClassTwo_H_
#include <span style="color:#A31515; "MyClassOne.h"
<span style="color:Blue; class MyClassTwo : <span style="color:Blue; public MyClassOne
{
<span style="color:Green; //...
};
#endif
<span style="color:Green; // file MyClassThree.h
#ifndef __MyClassThree_H_
#define __MyClassThree_H_
#include <span style="color:#A31515; "MyClassOne.h"
<span style="color:Blue; class MyClassThree : <span style="color:Blue; public MyClassOne
{
<span style="color:Green; //...
};
#endif
[/code]
Everything compiles well, but after compiling the linker throws some errors:
<div style="color:Black;background-color:White; <pre>
Error 4 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxFrameWindow): (0x02000262). I:myPathMyClassThree.obj MyClassLib
Error 5 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxUIWindow): (0x0200026b). I:myPathMyClassThree.obj MyClassLib
Error 6 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxFrameWindow>): (0x0200032a). I:myPathMyClassThree.obj MyClassLib
Error 7 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxUIWindow>): (0x0200032b). I:myPathMyClassThree.obj MyClassLib
Error 8 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxFrameWindow): (0x02000261). I:myPathMyClassTwo.obj MyClassLib
Error 9 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CAxUIWindow): (0x0200026a). I:myPathMyClassTwo.obj MyClassLib
Error 10 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxFrameWindow>): (0x02000329). I:myPathMyClassTwo.obj MyClassLib
Error 11 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information <span style="color:Blue; in duplicated types (ATL.CComObject<ATL::CAxUIWindow>): (0x0200032a). I:myPathMyClassTwo.obj MyClassLib
Error 12 error LNK1255: link failed because of metadata errors I:myPathLINK MyClassLib
[/code]
The interesting thing is, when I remove inheritance (so the #include "MyClassOne.h" in MyClassTwo and MyClassThree then the error disappears.<br/>
But I really need inheritance.
Btw: MyClassOne.cpp, MyClassTwo.cpp and MyClassThree.cpp are compiled using the /clr option.<br/>
MyClassOne.h, MyClassTwo.h and MyClassThree.h are also #included in other .h files that are included itself in other cpp files that are not compiled using /clr option.
If you need more information, just let me know.<br/>
Any idea?<br/>
<br/>
Thanks in advance <hr class="sig trust is a weakness, betrayal is the hidden blade
View the full article