C++ 以可视形式出现意外的文件结尾
尝试运行代码时出现错误。我使用的是视觉形式。VS 2013C++ 以可视形式出现意外的文件结尾,c++,forms,unexpectendoffile,C++,Forms,Unexpectendoffile,尝试运行代码时出现错误。我使用的是视觉形式。VS 2013 #include "MyForm.h" using namespace System; using namespace System::Windows::Forms; [STAThread] int main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRendering
#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.h”
使用名称空间系统;
使用命名空间System::Windows::Forms;
[状态线程]
int main(数组^args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm;
应用程序::运行(%form);
返回0;
}
MyForm.cpp(17):致命错误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) {
}
};
}
#pragma一次
命名空间项目1{
使用名称空间系统;
使用名称空间System::ComponentModel;
使用名称空间系统::集合;
使用命名空间System::Windows::Forms;
使用名称空间System::Data;
使用名称空间系统::绘图;
///
///我的表格摘要
///
公共引用类MyForm:public System::Windows::Forms::Form
{
公众:
我的表格(作废)
{
初始化组件();
//
//TODO:在此处添加构造函数代码
//
}
受保护的:
///
///清理所有正在使用的资源。
///
~MyForm()
{
if(组件)
{
删除组件;
}
}
私人:
///
///必需的设计器变量。
///
系统::组件模型::容器^组件;
#pragma区域Windows窗体设计器生成的代码
///
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
///
void初始化组件(void)
{
此->SuspendLayout();
//
//MyForm
//
这->自动缩放尺寸=系统::图纸::尺寸(6,13);
这->AutoScaleMode=System::Windows::Forms::AutoScaleMode::Font;
这->ClientSize=System::Drawing::Size(284262);
此->名称=L“MyForm”;
此->文本=L“MyForm”;
this->Load+=gcnewsystem::EventHandler(this,&MyForm::MyForm\u Load);
此->恢复布局(错误);
}
#布拉格端区
private:System::Void MyForm_Load(System::Object^sender,System::EventArgs^e){
}
};
}
MyForm.cpp(17):致命错误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);
}
#包括“MyForm.h”
使用名称空间系统;
使用命名空间System::Windows::Forms;
[状态线程]
void main(数组^arg){
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm;
应用程序::运行(%form);
}