Tag: linkage

C ++ / CLI-> C#错误C2526:C连接函数无法返回C ++类

我有一个使用VS2010 C#构建的简单.NET dll,它暴露了一个类的2个静态成员 public class Polygon { public static void Test(int test) {} public static void Test(List test) {} } 然后我从VS2010 C ++创建了一个Console应用程序,并在_tmain上面添加了这个函数 extern “C” void TestMe() { Polygon::Test(3); } 添加引用和编译会给我这个错误 1>WierdError.cpp(9): error C2526: ‘System::Collections::Generic::List::GetEnumerator’ : C linkage function cannot return C++ class ‘System::Collections::Generic::List::Enumerator’ 1> with 1> [ 1> T=int 1> ] 1> WierdError.cpp(9) : […]