在VC ++ CLR项目的最后'}'上构建错误

时间:2017-08-31 04:49:43

标签: c++ user-interface clr intellisense

我正在CLR为我在学校的Capstone开发一个项目,我发现构建一个UI很简单。我正在创建一个按钮,该按钮将运行一组简单的语句,这些语句会将某些条件设置为值,如果您将错误的值放入框中,则会出现错误。

这仅仅是问题的背景。它们是6个用于输入的文本框,除了变量名之外,代码都是相同的。所以我有3个工作,它会很好地构建。然后,在我复制并粘贴最后三个错误后,出现了更多我已经解决的错误。

Error   1   error C2059: syntax error : '}' c:\users\ibuypower\desktop\jjba-rpg character builder\jjba-rpg character builder\MyForm.h   1612    1   JJBA-RPG character builder
Error   2   error C2143: syntax error : missing ';' before '}'  c:\users\ibuypower\desktop\jjba-rpg character builder\jjba-rpg character builder\MyForm.h   1612    1   JJBA-RPG character builder
Error   3   IntelliSense: expected a declaration    c:\Users\iBUYPOWER\Desktop\JJBA-RPG character builder\JJBA-RPG character builder\MyForm.h   1612    1   JJBA-RPG character builder

在添加额外代码之前,它仍然有效。我会发布更多但我的MyForm超过1600行代码。

#include "MyForm.h"

using namespace JJBARPGcharacterbuilder;

[System::STAThreadAttribute]

int main()
{
JJBARPGcharacterbuilder::MyForm fm;
fm.ShowDialog();

return 0;
}

这是我的CPP文件,我不得不稍微修改它以删除其他错误。所有这三个错误都发生在MyForm.h文件的最后一个大括号中。我真的很难过,如果需要,我很乐意为上下文提供更多代码。

提前感谢所有人。

    private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
         String ^ Buildpoints_text = Buildpoints->Text;
         __int32 Buildpoints_Max = System::Int32::Parse(Buildpoints_text); // Takes the maximum amount of buildpoints and submits it as a integer
         if (Buildpoints_Max > 0){
             MessageBox::Show("Your buildpoints are " + Buildpoints_Max);
         }
         else{
             MessageBox::Show("Please input a maximum buildpoint value.");
         }
}

private: System::Void button3_Click_1(System::Object^  sender, 
System::EventArgs^  e) {
         String ^ Potential_letter = Potential_input->Text;
         int Potential_value;
             if (Potential_letter == "A"){
                 Potential_value = 3;
             }
             else if (Potential_letter == "B"){
                 Potential_value = 2;
             }
             else if (Potential_letter == "C"){
                 Potential_value = 1;
             }
             else if (Potential_letter == "D"){
                 Potential_value = 0;
             }
             else if (Potential_letter == "E"){
                 Potential_value = -1;
             }
             else {
                 MessageBox::Show("Incorrect Potential value.");
             }
    };
};
}
} //Error occurs here. It says it requires a semi-colon before. I add one and no change.

0 个答案:

没有答案