Author Topic: [QT] I can't debug my applications  (Read 6026 times)

claudio-cit

  • Guest
[QT] I can't debug my applications
« on: July 03, 2008, 03:29:56 pm »
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 an error building and running the debug:

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:

mingw32-make.exe -f Makefile.qmake.Debug
mingw32-make.exe[1]: Entering directory `C:/Projects/uno'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\uno.exe debug/Ciao.o  -L"c:\Qt\4.4.0\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lqtmaind
mingw32-make.exe[1]: Leaving directory `C:/Projects/uno'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [debug\uno.exe] Error 1
mingw32-make.exe: *** [Debug] Error 2
Process terminated with status 2 (0 minutes, 0 seconds)
1 errors, 0 warnings
« Last Edit: July 03, 2008, 04:18:35 pm by claudio-cit »

Offline Manolo

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: [QT] I can't debug my applications
« Reply #1 on: July 03, 2008, 06:21:40 pm »
The compiler is telling you:
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lqtmaind

You must set directories to search.
If (using a custom makefile)
 add -Ifull_path_to_file to compiler options
else
 For any project, use 'Settings->Complier and debugger'
 For the opened project, use 'Project->Buil options'
 For all/debug/release/yours configuration, add directory to 'Search directories' tab

FYI:
If you want to get debug facilities, option -g (or -gstabs, or...) must be passed to compiler. Modify your makefile.
If using MinGW, 'mingw32-g++.exe' should be used instead of 'g++' (Not a big danger, but it's better)

HTH
Manolo

claudio-cit

  • Guest
Re: [QT] I can't debug my applications
« Reply #2 on: July 03, 2008, 06:34:08 pm »
I've already set up that.

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?