error: ISO C++ forbids declaration of 'XXXX' with no type
来源:互联网 发布:程序员数学2pdf下载 编辑:程序博客网 时间:2024/04/28 05:01
出现这个错误,一般是由于两个CPP相互都相互包含了对方的头文件造成的,比如:
当mainwindow.cpp、configdialog.cpp两个文件,分别包含了对方的头文件,并且分别又在自己的类中声明了对象,即:
mainwindow.cpp
#include "configdialog.h"
class MainWindow {
ConfigDialog *configDialog;
};
configdialog.cpp
#include "mainwindow.h"
class ConfigDialog {
MainWindow *mainWindow;
};
解决方法是,在声明对象的类名称前追加关键字“class”,即修改如下:
mainwindow.cpp
#include "configdialog.h"
class MainWindow {
class ConfigDialog *configDialog;
};
configdialog.cpp
#include "mainwindow.h"
class ConfigDialog {
class MainWindow *mainWindow;
};
- error: ISO C++ forbids declaration of 'XXXX' with no type
- error: ISO C++ forbids declaration of ‘XXXX’ with no type
- error: ISO C++ forbids declaration of 'XXXX' with no type
- error: ISO C++ forbids declaration of 'XXXX' with no type
- error: ISO C++ forbids declaration of `FILE' with no type
- ISO C++ forbids declaration of ‘vector’ with no type
- [Qt] "iso c++ forbids declaration of QPushButton with no type ."
- 编译错误:ISO C++ forbids declaration of *** with no type
- ISO C++ forbids declaration of ‘Contack’ with no type [-fpermissive]
- error: ISO C++ forbids declaration of ‘xxx’ with no type [-fpermissive]
- error: ISO C++ forbids declaration of ‘xxx’ with no type [-fpermissive]
- ISO C++forbids declaration of 'SystemSetDialog' with no type的问题解决
- ISO C++ forbids declaration of with no type question ( Xlib.h)
- QT:编译错误:ISO C++ forbids declaration of *** with no type
- C++11下编译错误 ISO C++ forbids declaration of ‘typeof’ with no type
- google-breakpad在 C++11下编译错误 ISO C++ forbids declaration of ‘typeof’ with no type
- C++ stack 编译报错 forbids declaration of stack with no type
- error: invalid use of incomplete type 'XXXX' ;error: forward declaration of 'XXXX' 声明改为包含头文件
- Linux下搭建Qt+OpenGL
- ThinkPHP去掉URL中的index.php
- android查看数据表数据
- Java MSN Messenger Library (JML)
- Multi test Manager 出现消息 unable to launch quick test professional
- error: ISO C++ forbids declaration of 'XXXX' with no type
- flex study notes (2)
- 谈谈父窗口和所有者窗口
- SQL Server 2005 CLR 调用Web Service需要注意的几个问题
- Zimbra驾云而来:挑战微软IBM还缺一样法宝
- 用c++对mysql进行二进制数据的读写
- Android学习资料
- 《深入Java虚拟机》导读之六: 类和对象生命周期
- [VB.Net]获取新实例的命令行