标题:【提问】关于uic,请指教
作者:pimpyan
日期:2005-10-21 11:31
内容:
.ui+main.cpp----qmake+make没有问题...
但是uic xx.ui > xx.h
uic -i xx.h xx.ui -o xx.cpp
然后:xx.h+xx.cpp+main.cpp-------qmake -project + qmake + make = form1.h:18: 错误:multiple types in one declaration????
看了好久实在是不知道什么原因...
请教
我的xx.h:
#ifndef FORM1_H
#define FORM1_H
#include
#include
#include "Config.h"
#include "qstring.h"
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QLineEdit;
class QLabel;
class QPushButton;
class QComboBox;
class Form1 : public QDialog
{
Q_OBJECT
public:
Form1( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~Form1();
QLineEdit* password;
QLabel* textLabel1;
QPushButton* ok;
QPushButton* quit;
QLabel* textLabel2;
QComboBox* username;
Config cfg;
QString str;
protected:
protected slots:
virtual void languageChange();
};
#endif // FORM1_H
#1 [pimpyan 10-21 15:15]
我检查 了很久觉得是加入了自己定义的头文件而引起的错误.
"Config.h"
观察/include下面的头文件的写法会发现
用了
#ifndef
#define
#endif
我在自己的头文件里加入了此种定义.
但是还是不行!!
谁帮帮我啊!!!
#2 [tdns 10-24 10:55]
我也碰到过类似的问题。当时的解决方法是把被uic生成的.cpp和.h文件从.pro文件里拿掉,就可以编译成功了。当然main.cpp里面是需要包含uic生成的头文件的,如果你要用这个界面的话。
至今不太明白为什么会有这个问题,它到底是怎么包含的。你可以试试,想明白了告诉我