Как исправить ошибку компиляции c1001 в VS winform c++?

Создал пустой проект CLR. Следовал всем инструкциям и сравнивал гайды. Везде одно и тоже, но вылезает ошибка C1001 ссылаясь на строку public ref class MainForm. Это странно тк код сгенерирован автоматически


namespace Library {

    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 MainForm
    /// </summary>
    public ref class MainForm : public System::Windows::Forms::Form
    {
    public:
        MainForm(void)
        {
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }

    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~MainForm()
        {
            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->components = gcnew System::ComponentModel::Container();
            this->Size = System::Drawing::Size(300,300);
            this->Text = L"MainForm";
            this->Padding = System::Windows::Forms::Padding(0);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        }
#pragma endregion
    };
}

Так вглядит главная функция:

#include "MainForm.h"

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

[STAThreadAttribute]
void main(array<String^>^ args) {
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);
    Library::MainForm mainForm;
    Application::Run(% mainForm);
}

По гайдам я изменил эти настройки: Настройка 1 Настройка 2


Ответы (1 шт):

Автор решения: VHaleta

Нашёл решение. Нужно было установить extension для clr проектов. И при создании создавал не пустой, а CppSLR_Winforms.

→ Ссылка