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