如何解决错误C2512?

时间:2016-01-14 16:01:29

标签: visual-c++ constructor c++-cli

我已经解决了包括彼此在内的标题问题

但我有这个新错误c2512。这是我的代码:

“rstc.h”

public ref class rstc : public System::Windows::Forms::Form
{
    ref class ddc;
public:

    rstc(System::Windows::Forms::Form ^ y)
    {otherform = y;
        InitializeComponent();

    }
private: System::Windows::Forms::Form ^ otherform;

/////////////////////////////////

         ddc ^ x2 = gcnew ddc(this);//////is here where the error is pointed
         x2->Show();
         this->Hide();

“ddc.h”

public ref class ddc : public System::Windows::Forms::Form
{
    ref class rstc;
public:

    ddc(System::Windows::Forms::Form ^ y)
    {otherform = y;
        InitializeComponent();

    }
private: System::Windows::Forms::Form ^ otherform;

这段代码转到另一个形式“rstc”

         rstc ^ x2 = gcnew rstc(this);
         x2->Show();
         this->Hide();

我认为错误C2227与第一个错误有关 这是完整的错误

error C2512: 'final::ddc::rstc' : no appropriate default constructor available

0 个答案:

没有答案