新手在QT编译的时候出的问题,急求高手解决!
发表于 : 2010-11-04 23:19
在编辑helloqt中,代码是抄书上的,应该没问题的,但是编译过程中出现如下问题:
wyk3.cpp:2:22: error: QpushButton: 没有那个文件或目录
wyk3.cpp:3: error: conflicting declaration ‘int** argc’
wyk3.cpp:3: error: ‘argc’ has a previous declaration as ‘int argc’
wyk3.cpp:3: warning: ‘int main(int)’ takes only zero or two arguments
wyk3.cpp: In function ‘int main(int)’:
wyk3.cpp:5: error: ‘argv’ was not declared in this scope
wyk3.cpp:5: error: ‘QPushbutton’ was not declared in this scope
wyk3.cpp:5: error: expected ‘;’ before ‘pushbutton’
wyk3.cpp:6: error: ‘pushButton’ was not declared in this scope
wyk3.cpp:7: error: ‘Q0bject’ has not been declared
我敲的代码是:
#include<QApplication>
#include<QpushButton>
int main(int argc,char *argc[])
{
QApplication app(argc,argv);
QPushbutton pushbutton(Q0bject::tr("hello Qt!"));
pushButton.show();
Q0bject::connect(&pushButton,SIGNAL(clicked()),&app,SLOT(quit()));
return app.exec();
}
wyk3.cpp:2:22: error: QpushButton: 没有那个文件或目录
wyk3.cpp:3: error: conflicting declaration ‘int** argc’
wyk3.cpp:3: error: ‘argc’ has a previous declaration as ‘int argc’
wyk3.cpp:3: warning: ‘int main(int)’ takes only zero or two arguments
wyk3.cpp: In function ‘int main(int)’:
wyk3.cpp:5: error: ‘argv’ was not declared in this scope
wyk3.cpp:5: error: ‘QPushbutton’ was not declared in this scope
wyk3.cpp:5: error: expected ‘;’ before ‘pushbutton’
wyk3.cpp:6: error: ‘pushButton’ was not declared in this scope
wyk3.cpp:7: error: ‘Q0bject’ has not been declared
我敲的代码是:
#include<QApplication>
#include<QpushButton>
int main(int argc,char *argc[])
{
QApplication app(argc,argv);
QPushbutton pushbutton(Q0bject::tr("hello Qt!"));
pushButton.show();
Q0bject::connect(&pushButton,SIGNAL(clicked()),&app,SLOT(quit()));
return app.exec();
}