0

我尝试退出应用程序(需要了解 Visual C++ 程序的基本结构),但不接受 MSDN 的代码。我究竟做错了什么?

private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e)
{
}
 Application::Exit(); };

运行此代码时出现错误: error C3254: 'Program::Form1' : class contains explicit override 'Exit' but does not derive from an interface that contains the function declaration
error C2838: 'Exit' : illegal qualified name in member declaration
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
warning C4183: 'Exit': missing return type; assumed to be a member function returning 'int'

我找不到任何有用的信息,今天是我尝试 VS 2008 的第一天。

4

1 回答 1

5

我认为 Application::Exit(); 在错误的行中。以下工作是否有效:

private: System::Void exitToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
          Application::Exit(); }
};
于 2012-08-14T07:26:47.150 回答