首页| 论坛| 消息

标题:编译通不过,请高手帮忙???有源码
作者:dida424
日期:2006-10-19 19:30
内容:

//36.h
#include
#include
#include
#include
#include
class MyMainWindow :: public QWidget
{ Q_OBJECT
public :
MyMainWindow();
private:
QPushButton *b1;
QMultiLineEdit *edit;
public slots:
prt();
};
//36.cpp
#include"36.h"

void MyMainWindow::prt()
{
coutsetGeometry(10,10,180,30);
connect ( b1,SIGNAL(clicked()),qApp,SLOT(prt()));
};
//main.cpp
#include "36.h"
int main (int argc,char **argv)
{
QApplication a(argc,argv);
MyMainWindow w;
a.setMainWidget(&w);
w.show();
a.exec();
}
//36.pro
TEMPLATE = app
DESTDIR = $(QPEDIR)/bin
CONFIG += qtopia warn_on release
HEADERS = 36.h
SOURCES = 36.cpp
SOURCES+=main.cpp
TARGET = 36

tmake -o Makefile 36.pro
make
36.cpp:20: `connect' undeclared (first use this function)
/usr/include/c++/3.2.2/streambuf: At top level:
36.h:9: warning: `QMetaObject* staticMetaObject()' declared `static' but never
defined
36.h:9: warning: `QString tr(const char*)' declared `static' but never defined
36.h:9: warning: `QString tr(const char*, const char*)' declared `static' but
never defined
make: *** [36.o] Error 1
编译报错,请帮我看看


#1 [crash3 10-20 09:01]
我已经编译成功了,这是修改后的代码
//36.h
#include
#include
#include
#include
#include
class QWidget;
class MyMainWindow : public QWidget
{ Q_OBJECT
public :
MyMainWindow();
private:
QPushButton *b1;
QMultiLineEdit *edit;
public slots:
void prt();
};
//36.cpp
#include"36.h"

void MyMainWindow::prt()
{
coutsetGeometry(10,10,180,30);
connect ( b1,SIGNAL(clicked()),qApp,SLOT(prt()));
}
//main.cpp
#include "36.h"
int main (int argc,char **argv)
{
QApplication a(argc,argv);
MyMainWindow w;
a.setMainWidget(&w);
w.show();
return a.exec();
}
#2 [dida424 10-20 10:20]
老大,还是不行啊我的环境是x11 2.3.2,qtopia 1.7
#3 [nibiao 12-26 19:26]
少了qobject.h这个头文件吧 用到信号和槽没那个不行你加上试试

回复 发表
主题 版块