Results 1 to 3 of 3

Thread: debug with MinGW & Qt 4.4.0

  1. #1
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default debug with MinGW & Qt 4.4.0

    Hi,


    When I build Qt applications with the Qt makefile gdb cannot find the source files (even for my main.cpp). Exactly the same problem if I use the eclipse integration. I can successfully debug non-Qt applications with MinGW.

    Any ideas welcome.

    thanks
    Andrew

    MinGW version:
    g++ (GCC) 3.4.2 (mingw-special) (and I also tried 3.4.5)
    gdb version: 5.2.1 (configured as i686-pc-mingw32)
    Qt version 4.4.0

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: debug with MinGW & Qt 4.4.0

    Quote Originally Posted by andrew209 View Post
    Hi,


    When I build Qt applications with the Qt makefile gdb cannot find the source files (even for my main.cpp). Exactly the same problem if I use the eclipse integration. I can successfully debug non-Qt applications with MinGW.
    How do you do that? Could you write all the commands you run and the output.
    Last edited by lyuts; 30th May 2008 at 13:07.
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: debug with MinGW & Qt 4.4.0

    I generated a new eclipse Qt App project, with just one file, main.cpp. Depending on the content of main.cpp I can debug or not debug. If I include the Qt things, then debug cannot find the source code (though the execution is correct). Details follow:

    with this main:

    int main(int argc, char *argv[])
    {
    return 0;
    }

    ...everything is fine:

    G:\eclipse\qbasic>make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `G:/eclipse/qbasic'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt
    \4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtG
    ui" -I"c:\Qt\4.4.0\include\QtGui" -I"c:\Qt\4.4.0\include" -I"c:\Qt\4.4.0\include
    \ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.0\mkspecs\win32-g++" -o debug\main.o mai
    n.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -mthreads -Wl -Wl,-subsystem,windows -o debug\qbasic.exe debug/main.o -L"c:\
    Qt\4.4.0\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
    mingw32-make[1]: Leaving directory `G:/eclipse/qbasic'

    G:\eclipse\qbasic>gdb debug\qbasic.exe
    GNU gdb 5.2.1
    Copyright 2002 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32"...
    (gdb) b main
    Breakpoint 1 at 0x4012b5: file main.cpp, line 5.
    (gdb) run
    Starting program: G:\eclipse\qbasic/debug\qbasic.exe

    Breakpoint 1, main (argc=1, argv=0x3d3dc0) at main.cpp:5
    5 {
    (gdb) n
    12 return 0; perfect!
    (gdb) n
    13 }
    (gdb) n



    BUT If I change main to this:


    #include <QApplication>
    #include <QPushButton>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QPushButton hello("Hello world @" __TIME__);
    hello.show();

    return a.exec();
    }

    make clean, and then
    G:\eclipse\qbasic>make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `G:/eclipse/qbasic'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt
    \4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtCore" -I"c:\Qt\4.4.0\include\QtG
    ui" -I"c:\Qt\4.4.0\include\QtGui" -I"c:\Qt\4.4.0\include" -I"c:\Qt\4.4.0\include
    \ActiveQt" -I"debug" -I"." -I"c:\Qt\4.4.0\mkspecs\win32-g++" -o debug\main.o mai
    n.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -mthreads -Wl -Wl,-subsystem,windows -o debug\qbasic.exe debug/main.o -L"c:\
    Qt\4.4.0\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
    mingw32-make[1]: Leaving directory `G:/eclipse/qbasic'

    Now gdb can't get a grip on the source:


    G:\eclipse\qbasic>gdb debug\qbasic.exe
    GNU gdb 5.2.1
    Copyright 2002 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB. Type "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32"...
    (gdb) b main
    Breakpoint 1 at 0x4015b0
    (gdb) run
    Starting program: G:\eclipse\qbasic/debug\qbasic.exe

    Breakpoint 1, 0x004015b0 in main ()
    Current language: auto; currently c++
    (gdb) n
    Single stepping until exit from function main,
    which has no line number information.


    (then I just press the quit button on the window with the button in it)

    Program exited normally.
    (gdb) quit



    Environment:

    G:\eclipse\qbasic>path
    PATH=c:\MinGW\bin;c:\Qt\4.4.0\bin

    G:\eclipse\qbasic>set lib
    Environment variable lib not defined

    G:\eclipse\qbasic>set include
    Environment variable include not defined

    G:\eclipse\qbasic>g++ --version
    g++ (GCC) 3.4.2 (mingw-special)
    Copyright (C) 2004 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    G:\eclipse\qbasic>type qbasic.pro
    TEMPLATE = app
    TARGET = qbasic
    QT += core \
    gui
    HEADERS +=
    SOURCES += main.cpp
    FORMS +=
    RESOURCES +=


    thanks for your time!

Similar Threads

  1. A Guide to Install MinGW, Qt4 and Eclipse Integration on Windows XP
    By shiyutang in forum Installation and Deployment
    Replies: 10
    Last Post: 5th August 2009, 04:03
  2. Wich MinGW Version should i use for QT 4.4.0?
    By raphaelf in forum Installation and Deployment
    Replies: 3
    Last Post: 27th May 2008, 14:29
  3. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48
  4. Failure to build Debug libs - Vista Mingw Qt 4.3.2
    By pmabie in forum Installation and Deployment
    Replies: 8
    Last Post: 15th October 2007, 18:04
  5. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 17:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.