c++ - 带有 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]
这是什么?如何消除此错误?
解决方案
首先,Dev-C++ 不是编译器,而是 IDE(花哨的编辑器,简单来说)。它在引擎盖下使用某种其他编译器。可能是 gcc(来自 MINGW),我不记得了,因为 Dev-C++ 是相当过时的工具。
其次,您没有提供完整代码(编辑:稍后添加了完整代码),但基于错误我认为您已经在类中声明了一个方法并使用该类名对其进行了限定。这是不正确的,因为不需要资格。
即你应该做这样的事情:
class Test {
void test ();
};
不是这样的(我想你已经尝试过):
class Test {
void Test::test ();
};
推荐阅读
- javascript - javascript在地图中使用await
- javascript - React-Router:打开链接组件时如何隐藏主页?
- docker - 如何根据现有项目的变化自动构建新的自定义镜像?
- reactjs - 如何在我的反应应用程序中仅在一个组件中使用引导程序而不会弄乱布局?
- java - 反转大小写的Java方法不会反转所有字母
- python - SyntaxError:lib/python3.8/site-packages/sql_server/pyodbc/base.py django 在 Linux 上部署的语法无效
- docker - 建立从 Jenkins 容器到 SSH 服务器容器的 SSH 连接,我可以用密码登录建立但不能用私钥建立
- javascript - JavaScript 与 ReactJS 中的计时器准确性与在线计时器
- sql - “NOT”是否适用于 SQL 中的其他逻辑运算符?
- python-3.x - 从 Django 中的 TextChoices 类中获取字符串