读书人

怎么支持C++.net的混合类型

发布时间: 2012-03-27 13:44:24 作者: rapoo

如何支持C++.net的混合类型
#include<iostream>
#include<string>
using namespace System;
using namespace std;

namespace Namespacedll
{

public ref class Student
{
private:
int id;
int age;
string name; public:
Student();
Student(int _id,int _age);
};

错误1error C4368: 不能将“name”定义为托管“Namespacedll::Student”的成员: 不支持混合类型c:\users\zhang\desktop\clr制作dll\namespacedll\namespacedll\Student.h17


}

[解决办法]
http://msdn.microsoft.com/zh-cn/library/xhfb39es%28v=VS.90%29.aspx

string name;
改为
String^ name;

读书人网 >VC

热点推荐