Visual studio 2010 VC+中的构造函数输入错误+;
我创建了一个构造函数,如下所示Visual studio 2010 VC+中的构造函数输入错误+;,visual-studio-2010,c++-cli,Visual Studio 2010,C++ Cli,我创建了一个构造函数,如下所示 Form1(array<System::String ^> ^args) //HW5 { InitializeComponent(); // //TODO: Add the constructor code here // if (args->Length==0){ CregArray = gcnew array<CRegi
Form1(array<System::String ^> ^args) //HW5
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
if (args->Length==0){
CregArray = gcnew array<CRegistration^>(100);
record_number = 0;
}
else {
}
}
错误为“错误1错误C2664:'Project3::Form1::Form1(cli::array^)':无法将参数1从“const char[1]”转换为“cli::array^”您正在传入一个字符串,其中需要字符串数组。 此外,String::Empty比使用文本空字符串更好 试试这个:
array<System::String^>^ args = gcnew array<System::String^>(1);
args[0] = String::Empty;
Application::Run(gcnew Form1(args));
array^args=gcnewarray(1);
args[0]=String::Empty;
应用程序::运行(gcnewform1(args));
array<System::String^>^ args = gcnew array<System::String^>(1);
args[0] = String::Empty;
Application::Run(gcnew Form1(args));