首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VC >

刚学习vc.net 请问一个String做参数的有关问题,请高手指教一下

2012-01-05 
刚学习vc.net 请教一个String做参数的问题,请高手指教一下下面的代码为什么不能编译呢,出现这个错误呢.\cl

刚学习vc.net 请教一个String做参数的问题,请高手指教一下
下面的代码为什么不能编译呢,出现这个错误呢
.\clr.cpp(12) : error C3149: “System::String”: 此处没有顶级“^”,不能使用此类型
请高手指教一下,谢谢

// clr.cpp: 主项目文件。

#include "stdafx.h"
#include "stdio.h"
#include "windows.h"
using namespace System;
public ref class CustomEventAgs:public EventArgs
{
public:
  CustomEventAgs(System::String^ str);
private:
String msg;
};

int main(array<System::String ^> ^args)
{
char input,o;
  Console::WriteLine(L"Hello World");
  return 0;
}
CustomEventAgs::CustomEventAgs(System::String^ str)
{
throw(gcnew System::NotImplementedException);
}

[解决办法]
试试 Console::WriteLine(gcnew System::String^("Hello World"));

[解决办法]
String^ msg;

热点排行