在DevC++ IDE与TDM-GCC 4.9.2中出现额外的限定错误。

问题描述 投票:1回答:1

我有一个类函数,定义如下。

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/reflowchart-designer-and-simulator\GUI\Output.h [Error] extra qualification 'Output::' on member 'Drawcondition' [-fpermissive] (错误)。

这是什么情况?如何删除这个错误?

dev-c++
1个回答
2
投票

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

其次,你没有给出完整的代码(EDIT:完整的代码是后来添加的),但是根据错误,我认为你在类里面声明了一个方法,并且用这个类名来限定。这是不正确的,因为那里的限定是不需要的。

也就是说,你应该做这样的事情。

class Test {
        void test ();
};

而不是像这样(我猜你已经试过了)。

class Test {
        void Test::test ();
};
© www.soinside.com 2019 - 2024. All rights reserved.