cliext::list strange behavior
-
I am trying to use a cliext::list<> and am hitting various problems - apologies, its a long one - but stick with me :) . Before I start, I am using Visual Studio 2008 with service pack 1. I am (relatively) new to mixed mode programming - my background is pure C++ / MFC, etc - so it is entirely possible I am misunderstanding something. I have reduced my first problem to the following: Header file: #pragma once #include private ref class TestClass { cliext::list ^ m_list; public: TestClass(void); }; .cpp file: #include "StdAfx.h" #include "TestClass.h" TestClass::TestClass(void) : m_list(gcnew cliext::list()) { } Produces this little lot... (project name is LNK2022) 1>------ Build started: Project: LNK2022, Configuration: Debug Win32 ------ 1>Linking... 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Myhead): (0x0400000a). 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Mysize): (0x0400000b). 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Mygen): (0x0400000c). 1>TestClass.obj : error LNK2022: metadata operation failed (801311D7) : Differing number of fields in duplicated types (cliext.impl.list_impl): (0x02000023). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_impl; interfaces: System.Runtime.CompilerServices.CallConvStdcall): (0x09000001). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_impl; interfaces: System.IDisposable): (0x09000002). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_base; interfaces: System.Runtime.CompilerServices.CallConvFastcall): (0x09000003). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_base; interfaces: System.Runtime.CompilerServices.CallConvThiscall): (0x09000004). 1>TestClass.obj : error LNK20
-
I am trying to use a cliext::list<> and am hitting various problems - apologies, its a long one - but stick with me :) . Before I start, I am using Visual Studio 2008 with service pack 1. I am (relatively) new to mixed mode programming - my background is pure C++ / MFC, etc - so it is entirely possible I am misunderstanding something. I have reduced my first problem to the following: Header file: #pragma once #include private ref class TestClass { cliext::list ^ m_list; public: TestClass(void); }; .cpp file: #include "StdAfx.h" #include "TestClass.h" TestClass::TestClass(void) : m_list(gcnew cliext::list()) { } Produces this little lot... (project name is LNK2022) 1>------ Build started: Project: LNK2022, Configuration: Debug Win32 ------ 1>Linking... 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Myhead): (0x0400000a). 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Mysize): (0x0400000b). 1>TestClass.obj : error LNK2022: metadata operation failed (80131188) : Inconsistent field declarations in duplicated types (types: cliext.impl.list_impl; fields: _Mygen): (0x0400000c). 1>TestClass.obj : error LNK2022: metadata operation failed (801311D7) : Differing number of fields in duplicated types (cliext.impl.list_impl): (0x02000023). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_impl; interfaces: System.Runtime.CompilerServices.CallConvStdcall): (0x09000001). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_impl; interfaces: System.IDisposable): (0x09000002). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_base; interfaces: System.Runtime.CompilerServices.CallConvFastcall): (0x09000003). 1>TestClass.obj : error LNK2022: metadata operation failed (8013118B) : Inconsistent implemented interfaces in duplicated types (types: cliext.impl.list_base; interfaces: System.Runtime.CompilerServices.CallConvThiscall): (0x09000004). 1>TestClass.obj : error LNK20
I think you need to make
ref struct SInside
access level "public" due to the usage of generics in STL/CLR. However, if thisref struct SInside
is only going to be accessed within the same assembly, you can make it's access level "internal" or "protected public"."We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Thursday, August 28, 2008 3:39 PM