参考C ++ / CLI项目,C ++ / CLI枚举没有显示在C#中 [英] C++/CLI enum not showing up in C# with reference to C++/CLI project

查看:164
本文介绍了参考C ++ / CLI项目,C ++ / CLI枚举没有显示在C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以看到在我写的一个类中,甚至可以看到C ++ / CLI枚举的内容看到枚举,但我看不到枚举值。所以我不能使用我的C#方面的东西。



C ++ / CLI枚举的内容不会显示的任何原因。



我的C ++ / CLI项目被编译为混合以重用C ++库。



我使用的是Visual Studio 2005。 p>

解决方案

确保您使用枚举类来创建.NET兼容枚举,而不是本机C ++ 枚举类型。



以后的Visual C ++版本需要 public枚举类,从C ++ 11的一部分(因此创建本机类型)的枚举类消除歧义。 p>

I can't get the contents of an C++/CLI enum to show up in a C# project.

I can see inside a class I wrote, and even see the enum, but I can't see the enum values. So I can't use the thing on my C# side.

Any reason why contents of a C++/CLI enum wouldn't show up.

My C++/CLI project is compiled as mixed to reuse a C++ library.

And I'm using Visual Studio 2005.

解决方案

Make sure you used enum class to create a .NET-compatible enumeration, and not a native C++ enum type.

Later versions of Visual C++ require public enum class, to disambiguate from the enum class contextual keyword which is part of C++11 (and therefore creates a native type).

这篇关于参考C ++ / CLI项目,C ++ / CLI枚举没有显示在C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆