codeblocks 8.02。 ,win xp SP2,Qt 4.6需要帮助配置Qt的代码块!
安装完Qt SDK之后,我安装了QtWorkbench(codeblocks插件,可以让你创建Qt应用程序。)http://code.google.com/p/qtworkbench/。
我按照该页面的指示工作。我打开文件夹“对话框”,并在其中打开了一个新的空白代码块项目。在这个文件夹中的“对话框”中,我打开了一个新的目录“complexwizard”。在complexwizard是简单的main.cpp:
#include <QWidget>
#include <QApplication>
#include <QPushButton>
#include <QLabel>
#include <QDesktopWidget>
class Communicate : public QWidget
{
Q_OBJECT
public:
Communicate(QWidget *parent = 0);
private slots:
void OnPlus();
void OnMinus();
private:
QLabel *label;
};
void center(QWidget *widget, int w, int h)
{
int x, y;
int screenWidth;
int screenHeight;
QDesktopWidget *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
x = (screenWidth - w)/2;
y = (screenHeight - h)/2;
widget->move(x, y);
}
Communicate::Communicate(QWidget *parent)
: QWidget(parent)
{
int WIDTH = 350;
int HEIGHT = 190;
resize(WIDTH, HEIGHT);
QPushButton *plus = new QPushButton("+", this);
plus->setGeometry(50, 40, 75, 30);
QPushButton *minus = new QPushButton("-", this);
minus->setGeometry(50, 100, 75, 30);
label = new QLabel("0", this);
label->setGeometry(190, 80, 20, 30);
connect(plus, SIGNAL(clicked()), this, SLOT(OnPlus()));
connect(minus, SIGNAL(clicked()), this, SLOT(OnMinus()));
center(this, WIDTH, HEIGHT);
}
void Communicate::OnPlus()
{
int val = label->text().toInt();
val++;
label->setText(QString::number(val));
}
void Communicate::OnMinus()
{
int val = label->text().toInt();
val--;
label->setText(QString::number(val));
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Communicate window;
window.setWindowTitle("Communicate");
window.show();
return app.exec();
}
然后我说,“的main.cpp”在一个空白的项目,并全部按该网页上的说明进行配置。
当我开始编译程序,编译器总是说:
*看来,这个项目尚未建成。你想现在建立吗? *
我按是一个得到了这样的信息:
过程终止状态2(0分0秒) 0错误,0警告
在文件夹 “对话框”,其中是一个项目,创建新的文件:
complexwizard.pro
Makefile.complexwizard
Makefile.complexwizard.Debug
Makefile.complexwizard.Release
因为我是比较新的编程,编译器和其他东西的世界,这并没有告诉我很多。
因此,我问一个谁有这些症状的基础上提出一些建议,以帮助我从静止中删除它。 如果你有兴趣,我会添加更多的数据将需要
对此完全确认。使用QtCreator是因为这是使用Qt编写应用程序的“官方”方式。与文档的整合也非常好。是否有一个特定的原因,nik_02,为什么你不使用Qt Creator? – BastiBen 2010-11-27 17:21:21