gpt4 book ai didi

c++ - 视觉形式的意外文件结束

转载 作者:太空宇宙 更新时间:2023-11-04 13:40:40 25 4
gpt4 key购买 nike

尝试运行代码时出现错误。我正在使用可视化表单。对比 2013

#include "MyForm.h"

using namespace System;
using namespace System::Windows::Forms;

[STAThread]

int main(array<String^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

Project1::MyForm form;
Application::Run(%form);
return 0;
}

MyForm.cpp(17): fatal error C1004: 发现意外的文件结尾

我的表格.h:

#pragma once

namespace Project1 {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}

private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->SuspendLayout();
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 262);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
this->ResumeLayout(false);

}
#pragma endregion
private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
}
};
}

MyForm.cpp(17): fatal error C1004: 发现意外的文件结尾

最佳答案

我只是遗漏了代码中的一些内容。

#include "MyForm.h"

using namespace System;
using namespace System ::Windows::Forms;

[STAThread]
void main(array<String^>^ arg) {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

Project1::MyForm form;
Application::Run(%form);
}

关于c++ - 视觉形式的意外文件结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27748441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com