参考 C++/CLI 项目,C++/CLI 枚举未显示在 C# 中

发布于 2024-11-29 09:56:01 字数 201 浏览 1 评论 0原文

我无法让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

护你周全 2024-12-06 09:56:01

确保您使用 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 the enum class contextual keyword which is part of C++11 (and therefore creates a native type).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文