在编辑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();
}
新手在QT编译的时候出的问题,急求高手解决!
-
- 帖子: 4
- 注册时间: 2010-10-05 18:43
- linlee
- 帖子: 1132
- 注册时间: 2007-10-20 11:30
Re: 新手在QT编译的时候出的问题,急求高手解决!
#include<QpushButton>改成#include<QPushButton> ?
猜的~
猜的~
-
- 帖子: 58
- 注册时间: 2009-10-29 0:43
Re: 新手在QT编译的时候出的问题,急求高手解决!
你这个程序不完整呢!应该要申明个构造函数的!
你应该找个完整的,而且能编译通过的工程,学习学习!
我也是刚学
你应该找个完整的,而且能编译通过的工程,学习学习!
我也是刚学
-
- 帖子: 102
- 注册时间: 2008-03-08 8:45
Re: 新手在QT编译的时候出的问题,急求高手解决!
#include <QtGui/QPushButton> 首先要这么些~~~不知道是否一定这样写 但这样一定正确
还有 按钮要这么新建
QPushButton Button = new QPushButton(...);
还有 按钮要这么新建
QPushButton Button = new QPushButton(...);
-
- 帖子: 598
- 注册时间: 2009-09-19 20:50
Re: 新手在QT编译的时候出的问题,急求高手解决!
你是怎么编译的,应该是
代码: 全选
qmake -project
qmake
make
aMule 2.3.1 is coming...
真正动态的 amule-dlp is coming...
本人帐号在2011年1月被盗,在2011年1月3日17:19到2010年1月6日13:34之间本帐号发的一切帖子、短信等与本人无关!
amule-dlp 开发动态
amule-dlp on Google Code
WebArchiver - 基于 wget 的网页归档工具(PyQt4 GUI 前端)
Linux 2.6.34 编译笔记
真正动态的 amule-dlp is coming...
本人帐号在2011年1月被盗,在2011年1月3日17:19到2010年1月6日13:34之间本帐号发的一切帖子、短信等与本人无关!
amule-dlp 开发动态
amule-dlp on Google Code
WebArchiver - 基于 wget 的网页归档工具(PyQt4 GUI 前端)
Linux 2.6.34 编译笔记
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- 自由建客
- 帖子: 13468
- 注册时间: 2008-07-30 23:21
- 系统: Debian stable AMD64
Re: 新手在QT编译的时候出的问题,急求高手解决!
抄都抄错了,随便看看,最后一行,Q0bject ,注意那个是大写字母 欧 ,不是数字 零 。
- 水木杨
- 帖子: 33
- 注册时间: 2010-03-22 9:42
Re: 新手在QT编译的时候出的问题,急求高手解决!
你这个错误还真多……根据错误提示一步一步排查就行了,比如第一个是QApplication,main函数中参数名字有冲突……