加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

visual-c-C在本地代码中声明一个托管变量

发布时间:2020-12-16 05:19:51 所属栏目:百科 来源:网络整理
导读:我的Visual Studio中有一个.NET表单和一个本地代码.问题是:我无法在我的本机代码中声明一个.NET表单的全局实例,如下所示: Editor^ maineditor; 它给我这个问题: error C3145: 'EditorEntry' : global or static variable may not have managed type 'Cube
我的Visual Studio中有一个.NET表单和一个本地代码.问题是:我无法在我的本机代码中声明一个.NET表单的全局实例,如下所示:
Editor^ maineditor;

它给我这个问题:

error C3145: 'EditorEntry' : global or static variable may not have managed type 'Cube3D::Editor ^'

解决方法

而不是使用全局静态尝试,使其成为容器类型中的静态方法
ref class ManagedGlobals {
  public:
  static Editor^ maineditor = nullptr;
};

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读