新手在QT编译的时候出的问题,急求高手解决!

软件和网站开发以及相关技术探讨
回复
har4
帖子: 4
注册时间: 2010-10-05 18:43

新手在QT编译的时候出的问题,急求高手解决!

#1

帖子 har4 » 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();
}
头像
linlee
帖子: 1132
注册时间: 2007-10-20 11:30

Re: 新手在QT编译的时候出的问题,急求高手解决!

#2

帖子 linlee » 2010-11-05 10:10

#include<QpushButton>改成#include<QPushButton> ?
猜的~
crh8539
帖子: 58
注册时间: 2009-10-29 0:43

Re: 新手在QT编译的时候出的问题,急求高手解决!

#3

帖子 crh8539 » 2010-11-07 9:17

你这个程序不完整呢!应该要申明个构造函数的!
你应该找个完整的,而且能编译通过的工程,学习学习!
我也是刚学 :em06
darouwan
帖子: 102
注册时间: 2008-03-08 8:45

Re: 新手在QT编译的时候出的问题,急求高手解决!

#4

帖子 darouwan » 2010-11-22 17:50

#include <QtGui/QPushButton> 首先要这么些~~~不知道是否一定这样写 但这样一定正确
还有 按钮要这么新建
QPushButton Button = new QPushButton(...);
Bill Lee
帖子: 598
注册时间: 2009-09-19 20:50

Re: 新手在QT编译的时候出的问题,急求高手解决!

#5

帖子 Bill Lee » 2010-11-22 17:57

你是怎么编译的,应该是

代码: 全选

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 编译笔记
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 新手在QT编译的时候出的问题,急求高手解决!

#6

帖子 eexpress » 2010-11-22 21:07

不如直接用qtcreator。
虽然不能自动设置好connect,其他的方面,至少不需要你去折腾。
● 鸣学
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

Re: 新手在QT编译的时候出的问题,急求高手解决!

#7

帖子 自由建客 » 2010-11-24 1:29

抄都抄错了,随便看看,最后一行,Q0bject ,注意那个是大写字母 欧 ,不是数字 零 。
头像
水木杨
帖子: 33
注册时间: 2010-03-22 9:42

Re: 新手在QT编译的时候出的问题,急求高手解决!

#8

帖子 水木杨 » 2010-11-24 16:34

你这个错误还真多……根据错误提示一步一步排查就行了,比如第一个是QApplication,main函数中参数名字有冲突……
回复