Winforms 尝试在C+;中制作GUI程序时出现致命错误c1001+;MSVS Enterprise 2019 16.4.6中使用.NET内核的CLR 我尝试制作一个C++ GUI程序,我从一个空项目开始,然后添加源文件,即UI -Windows窗体,并生成一个主函数调用它。但是当我试着运行它时,它总是显示这个错误
C1001编译器中发生内部错误 我还将链接器->系统->子系统设置为windows(/subsystem:windows) 并将入口点设置为我的主函数。 这是我的主要cpp文件Winforms 尝试在C+;中制作GUI程序时出现致命错误c1001+;MSVS Enterprise 2019 16.4.6中使用.NET内核的CLR 我尝试制作一个C++ GUI程序,我从一个空项目开始,然后添加源文件,即UI -Windows窗体,并生成一个主函数调用它。但是当我试着运行它时,它总是显示这个错误,winforms,c++-cli,Winforms,C++ Cli,C1001编译器中发生内部错误 我还将链接器->系统->子系统设置为windows(/subsystem:windows) 并将入口点设置为我的主函数。 这是我的主要cpp文件 #include "MyForm.h" using namespace Project1; using namespace System::Windows::Forms; using namespace System::Windows; int main() { Application::EnableVisu
#include "MyForm.h"
using namespace Project1;
using namespace System::Windows::Forms;
using namespace System::Windows;
int main()
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Project1::MyForm form;
Application::Run(% form);
}
这是我的头文件(由VS自动创建)
#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(1089508);
此->名称=L“MyForm”;
此->文本=L“MyForm”;
此->恢复布局(错误);
}
#布拉格端区
};
}
它有超过2k的警告,我不可能把它全部放在这里对于gui应用程序来说,它不是正常的
WinMain
吗?对不起,你能解释一下关于WinMain的更多信息吗。我对这方面真的很陌生。这是一项大学作业。项目配置不正确。不要以.NETCore模板开始。生存指南:我从空的Fraster开始,详细介绍如何创建C++ Windows窗体应用程序的步骤,我建议您可以参考链接:
#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(1089, 508);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->ResumeLayout(false);
}
#pragma endregion
};
}