claudio-cit
3rd July 2008, 14:31
Hello guys, I'm new here. I hope you can help me.
I'm using code::blocks with QT and MinGW installed on Windows Xp.
I've done a new QT4 project and specified the QT folder.
The c++ code is ok, because I can compile by terminal the release and it works.
I get a lot of errors building and running the debug: it doesn't link the QT libraries. How I can specify the right place where to pick them to codeblock?
Thank you, C.
p.s.
CODE:
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QWidget>
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0);
};
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
setFixedSize(200, 120);
QPushButton *quit = new QPushButton(tr("Quit"), this);
quit->setGeometry(62, 40, 75, 30);
quit->setFont(QFont("Times", 18, QFont::Bold));
connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyWidget widget;
widget.show();
return app.exec();
}
ERROR:
C:\Projects\uno\Ciao.cc|1|QApplication: No such file or directory|
C:\Projects\uno\Ciao.cc|2|QFont: No such file or directory|
C:\Projects\uno\Ciao.cc|3|QPushButton: No such file or directory|
C:\Projects\uno\Ciao.cc|4|QWidget: No such file or directory|
C:\Projects\uno\Ciao.cc|7|error: expected class-name before '{' token|
C:\Projects\uno\Ciao.cc|9|error: expected `)' before '*' token|
C:\Projects\uno\Ciao.cc|11|error: expected `)' before '*' token|
C:\Projects\uno\Ciao.cc|11|error: expected `,' or `;' before '*' token|
C:\Projects\uno\Ciao.cc||In function `int main(int, char**)':|
C:\Projects\uno\Ciao.cc|24|error: `QApplication' undeclared (first use this function)|
C:\Projects\uno\Ciao.cc|24|error: (Each undeclared identifier is reported only once for each function it appears in.)|
C:\Projects\uno\Ciao.cc|24|error: expected `;' before "app"|
C:\Projects\uno\Ciao.cc|26|error: 'class MyWidget' has no member named 'show'|
C:\Projects\uno\Ciao.cc|27|error: `app' undeclared (first use this function)|
||=== Build finished: 13 errors, 0 warnings ===|
I'm using code::blocks with QT and MinGW installed on Windows Xp.
I've done a new QT4 project and specified the QT folder.
The c++ code is ok, because I can compile by terminal the release and it works.
I get a lot of errors building and running the debug: it doesn't link the QT libraries. How I can specify the right place where to pick them to codeblock?
Thank you, C.
p.s.
CODE:
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QWidget>
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0);
};
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
setFixedSize(200, 120);
QPushButton *quit = new QPushButton(tr("Quit"), this);
quit->setGeometry(62, 40, 75, 30);
quit->setFont(QFont("Times", 18, QFont::Bold));
connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyWidget widget;
widget.show();
return app.exec();
}
ERROR:
C:\Projects\uno\Ciao.cc|1|QApplication: No such file or directory|
C:\Projects\uno\Ciao.cc|2|QFont: No such file or directory|
C:\Projects\uno\Ciao.cc|3|QPushButton: No such file or directory|
C:\Projects\uno\Ciao.cc|4|QWidget: No such file or directory|
C:\Projects\uno\Ciao.cc|7|error: expected class-name before '{' token|
C:\Projects\uno\Ciao.cc|9|error: expected `)' before '*' token|
C:\Projects\uno\Ciao.cc|11|error: expected `)' before '*' token|
C:\Projects\uno\Ciao.cc|11|error: expected `,' or `;' before '*' token|
C:\Projects\uno\Ciao.cc||In function `int main(int, char**)':|
C:\Projects\uno\Ciao.cc|24|error: `QApplication' undeclared (first use this function)|
C:\Projects\uno\Ciao.cc|24|error: (Each undeclared identifier is reported only once for each function it appears in.)|
C:\Projects\uno\Ciao.cc|24|error: expected `;' before "app"|
C:\Projects\uno\Ciao.cc|26|error: 'class MyWidget' has no member named 'show'|
C:\Projects\uno\Ciao.cc|27|error: `app' undeclared (first use this function)|
||=== Build finished: 13 errors, 0 warnings ===|