标识符形式未定义

Identifier form is undefined

我该如何解决问题:

我是 C/C++ 的新手,所以我不知道必须提供哪些信息才能正确描述我的问题。我所做的一切就是试图按照 here 的家伙一步一步地合并 Windows 表格。他让一切正常,而我却没有,即使我做的事情和他做的完全一样。

错误代码如下:

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

[STAThreadAttribute]
void Main(array<String^>^ args) {
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    Project1::MyForm form;
    Application::Run(%form);
}

您真的应该为自己省去很多痛苦并使用 C# 作为您的 GUI,并且仅使用 C++/CLI 将本机非托管 C++ 代码包装在您的 C# GUI 中。

无论如何,Project1 不是一个命名空间,所以就放弃吧。试试这个:

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

[STAThreadAttribute]
void Main(array<String^>^ args) {
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    MyForm form;
    Application::Run(%form);
}