【问题标题】:c++ managed codeC++ 托管代码
【发布时间】:2012-03-01 16:27:41
【问题描述】:
1 #include"unmanaged.h"
2 #include"stdafx.h"
3 using namespace std;
4 _gc class Mclass
5 {
6 private:
7 string Mx;
8 cppclass * obj;
9 public:
10 Mclass();
11 ~Mclass();
12  string native();
13 };

当构建这个抛出时

错误 C4430:缺少类型说明符 - 假定为 int。

注意:C++ 不支持 default-int 和

错误 C2143:语法错误:缺少 ';'之前'

unmanged.h的内容是

#include"stdafx.h"
#include<string>
#include<iostream>
using namespace std;
class cppclass
{
private:
string x;
public:
cppclass();
~cppclass();
string native();
};

【问题讨论】:

  • 请格式化您的代码并显示错误的行号。
  • __gc 中需要两个下划线。
  • @ManuDilipShah 如果它解决了您的问题,请不要忘记选择 Mankarse 的答案!

标签: c++


【解决方案1】:

__gc 中需要两个下划线。见msdn

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    • 1970-01-01
    • 2011-04-29
    • 1970-01-01
    • 1970-01-01
    • 2011-10-06
    相关资源
    最近更新 更多