• 7024阅读
  • 2回复

【提问】关于uic,请指教 [复制链接]

上一主题 下一主题
离线pimpyan
 

只看楼主 倒序阅读 楼主  发表于: 2005-10-21
.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 <qvariant.h>
#include <qdialog.h>
#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
[ 此贴被XChinux在2005-10-21 23:48重新编辑 ]
离线pimpyan

只看该作者 1楼 发表于: 2005-10-21
我检查 了很久觉得是加入了自己定义的头文件而引起的错误.
"Config.h"
观察/include下面的头文件的写法会发现
用了
#ifndef
#define
#endif
我在自己的头文件里加入了此种定义.
但是还是不行!!
谁帮帮我啊!!!
离线tdns

只看该作者 2楼 发表于: 2005-10-24
我也碰到过类似的问题。当时的解决方法是把被uic生成的.cpp和.h文件从.pro文件里拿掉,就可以编译成功了。当然main.cpp里面是需要包含uic生成的头文件的,如果你要用这个界面的话。
至今不太明白为什么会有这个问题,它到底是怎么包含的。你可以试试,想明白了告诉我
快速回复
限100 字节
 
上一个 下一个