//36.h
#include<qapplication.h>
#include<qwidget.h>
#include<qpushbutton.h>
#include<qmultilineedit.h>
#include<iostream.h>
class MyMainWindow :: public QWidget
{ Q_OBJECT
public :
MyMainWindow();
private:
QPushButton *b1;
QMultiLineEdit *edit;
public slots:
prt();
};
//36.cpp
#include"36.h"
void MyMainWindow::prt()
{
cout<<"that is ok";
}
MyMainWindow::MyMainWindow()
{
resize(200,250);
b1=new QPushButton("SEND",this);
b1->setGeometry(50,100,50,30);
edit=new QMultiLineEdit(this);
edit->setGeometry(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
编译报错,请帮我看看
[ 此贴被XChinux在2006-10-21 09:34重新编辑 ]