参考 C++/CLI 项目,C++/CLI 枚举未显示在 C# 中
我无法让 C++/CLI 枚举的内容显示在 C# 项目中。
我可以看到我编写的类的内部,甚至可以看到枚举,但我看不到枚举值。所以我不能在我的 C# 端使用这个东西。
C++/CLI 枚举内容无法显示的任何原因。
我的 C++/CLI 项目被编译为混合以重用 C++ 库。
我正在使用 Visual Studio 2005。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您使用
enum class
创建 .NET 兼容的枚举,而不是本机 C++enum
类型。Visual C++ 的更高版本需要
public enum class
,以消除与作为 C++11 一部分的enum class
上下文关键字的歧义(因此创建本机类型)。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 theenum class
contextual keyword which is part of C++11 (and therefore creates a native type).