【问题标题】:Error C2143: missing ';' before '->'错误 C2143:缺少“;”在'->'之前
【发布时间】:2012-02-22 09:01:59
【问题描述】:

我在这里和互联网上进行了搜索,似乎没有人遇到与我类似的问题,我无法弄清楚为什么我无法让它工作。

阻止我编译的行是:

LitCiterCommon::LitCiterTrace->Init();

如果我从不同的文件 (c#) 调用 LitCiterTrace.Init(),它编译得很好,但由于某种原因,我无法从托管 cpp 调用它。

有什么想法或建议吗?

【问题讨论】:

  • 你试过用 :: 代替 -> 吗?
  • Init 可能是一个静态函数。你需要这样称呼它:LitCiterCommon::LitCiterTrace::Init();

标签: c# c++-cli managed


【解决方案1】:

如果Initstatic method then it would not be any different than in C++

// this is no different than calling a static member method in C++
LitCiterCommon::LitCiterTrace::Init();

【讨论】:

  • 哈哈,我什至没有注意到我的搭档在我离开时将其更改为静态方法......我真的需要停止休假离开这个代码库。再次感谢你发现我的愚蠢。
猜你喜欢
  • 2011-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-20
  • 1970-01-01
相关资源
最近更新 更多