首页 > 解决方案 > 带有 TDM-GCC 4.9.2 的 DevC++ IDE 中的额外限定错误

问题描述

我有一个定义如下的类函数:

class Output 
{ 

private:

window* pWind;  

public:

Output();

    window* CreateWind(int, int, int, int);
    void CreateDesignToolBar(); //Tool bar of the design mode
    void CreateSimulationToolBar();//Tool bar of the simulation mode
    window * getwindow()const;
    void CreateStatusBar();
    void CreateDrawArea();

    Input* CreateInput(); //creates a pointer to the Input object   
    void ClearStatusBar();  //Clears the status bar
    void ClearDrawArea();   //Clears the drawing area

    void DrawAssign(Point Left, int width, int height, string Text, bool Selected = false);
   void Output::Drawcondition(Point left, int width, int height, int t_width, int t_height, string Text, bool Selected = false);

当我在 DevC++ 中编译源代码时,我得到:

33 7 C:\Users\user\source\repos\flowchart-designer-and-simulator\GUI\Output.h [错误] 成员 'Drawcondition' 上的额外限定 'Output::' [-fpermissive]

这是什么?如何消除此错误?

标签: c++dev-c++

解决方案


首先,Dev-C++ 不是编译器,而是 IDE(花哨的编辑器,简单来说)。它在引擎盖下使用某种其他编译器。可能是 gcc(来自 MINGW),我不记得了,因为 Dev-C++ 是相当过时的工具。

其次,您没有提供完整代码(编辑:稍后添加了完整代码),但基于错误我认为您已经在类中声明了一个方法并使用该类名对其进行了限定。这是不正确的,因为不需要资格。

即你应该做这样的事情:

class Test {
        void test ();
};

不是这样的(我想你已经尝试过):

class Test {
        void Test::test ();
};

推荐阅读