error: declaration does not declare anything [-fpermissive]
时间: 2023-12-09 17:05:27 浏览: 91
This error message typically occurs when a variable or function declaration is missing a data type or identifier.
For example, the following code will produce this error:
```
int; // missing identifier
void(); // missing function name
```
To fix the error, make sure that all variable and function declarations include a data type and identifier:
```
int x; // variable declaration with data type and identifier
void foo(); // function declaration with data type (void) and identifier (foo)
```
If you are still encountering the error, make sure that your code is properly formatted and that all necessary headers and libraries are included.
相关问题
F:\untitled\mainwindow.cpp:55: error: out-of-line definition of 'on_clearButton_clicked' does not match any declaration in 'MainWindow'
这个错误提示是因为你在 `mainwindow.cpp` 文件中定义了 `on_clearButton_clicked` 函数,但是该函数没有在 `mainwindow.h` 文件中进行声明。
在 `mainwindow.h` 文件中添加以下声明:
```cpp
private slots:
void on_clearButton_clicked();
```
然后在 `mainwindow.cpp` 文件中实现该函数即可。
D:\ASN\hyhggy\dby\widget.cpp:293: error: out-of-line definition of 'resizeEvent' does not match any declaration in 'Widget'
这个错误的意思是你在 `widget.cpp` 文件的第 293 行定义的 `resizeEvent` 函数与 `Widget` 类中声明的函数不匹配。可能是函数的参数不一致或者函数名字不正确。
你可以检查一下 `Widget` 类中的 `resizeEvent` 函数声明的参数是否与你在 `widget.cpp` 中定义的一致。另外,你也可以确认一下 `resizeEvent` 函数的拼写是否正确。
如果你仍然无法解决这个问题,也可以考虑将代码片段贴到 Stack Overflow 或者其他社区网站上,寻求帮助。