PDA

View Full Version : [QT] I can't debug my applications



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 ===|

lyuts
3rd July 2008, 16:12
How did you install QT libraries?

claudio-cit
3rd July 2008, 16:23
I installed QT 4.4 with MinGW and followed the go-ahead-buttons during the installation. How do I should? Is there something to set up and/or compile?

claudio-cit
3rd July 2008, 17:24
I've tried with this comand:

C:\Qt\4.4.0\src>qtvars.bat compile_debug

and now this is the situation:

1. I click on Tools > qmake
2. I click on Bulid > Build
3. I click on Build > Run

and after the 3rd step I get an allert:

"It seems that this project has not been built yet. Do you want to build it now?"

4. Obviously I click yes but it just build it without running. I've checked also on process list.
If I click no it open the dos prompt and behave like if the program was launched, but it's not.

But actually after 3rd step it's already built and if I go on the folder and I click it, it runs.

Pretty strange, isn't it? It's pretty annoying too.. who knows how to fix it?