【问题标题】:Visual C++ Compiler error 2061Visual C++ 编译器错误 2061
【发布时间】:2011-11-10 09:21:25
【问题描述】:

我是 Visual C++ 的新手,所以请不要咬我的头。我不知道为什么我会收到这个错误。我在 Form1.h 中添加了 Parts.h 的包含,我相信我有正确的代码来调用它。如果有人可以帮助我解决这个问题,我将不胜感激。

这是错误:

Error   1   error C2061: syntax error : identifier 'Parts'  c:\users\*********\documents\visual studio 2005\projects\machinev.2\machinev.2\Form1.h  116

这是代码:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 Parts ^Parts = gcnew Parts();
                 Parts->ShowDialog();

【问题讨论】:

    标签: .net c++ visual-c++ dialog compiler-errors


    【解决方案1】:
    零件^零件= gcnew零件(); 零件-> ShowDialog();

    不要为类和变量使用相同的名称。

    【讨论】:

    • 非常感谢。我应该知道这是非常基本的,不过非常感谢。
    猜你喜欢
    • 1970-01-01
    • 2019-11-16
    • 2010-10-09
    • 2011-09-28
    • 1970-01-01
    • 1970-01-01
    • 2010-11-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多