当前位置: 代码迷 >> VC >> 刚学习vc.net 请问一个String做参数的有关问题,请高手指教一下
  详细解决方案

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

热度:5014   发布时间:2013-02-25 00:00:00.0
刚学习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;
  相关解决方案