Qt World Summit: Submit your Presentation

QT debugger problem

  • I have been trying to get the QT debugger to work. I have managed to finish my application, but it would have been nice to have the debugger along the way.

    Ok some information. I downloaded it off the main QT site. It doesn't really give a list of QT versions, it just downloads one file qt-unified-windows-x86-2.05-1-online.

    So I installed it and the version in the debug and release says.
    Desktop Qt 5.8.0 MSVC2015_64bit

    OK I can compile ok and run apps, but the debugger kept complaining it did not exist.

    So I run the updater and installed mingw.

    Now the debugger runs but says the file format not recognised.

    I think it is because it is using mingw to debug, but running microsoft to compile.

    All I want to know is how do I debug using microsoft?

    Or how do I install a mingw solution with correct debugger?

    I think the mingw debugger is working, but I can't compile mingw, as it is fixed to microsoft.

    Any help would be appreciated.

  • Lifetime Qt Champion


    You can't mix and match debuggers and compilers. If you want to use the MinGW debugger then install the Qt for MinGW package.

    If you want to debug your MSVC version, you'll have to grab the debugger from Microsoft's website. Yes, it's a separate download, the debugger from Visual Studio only works within Visual Studio.

  • @SGaist
    Good news is that I have just solved it.

    Here are the steps I did.
    I downloaded winsdksetup.exe for windows 10
    installed and then rebooted and run qt

    In tools/options/kits

    I clicked on the one with the exclamation mark
    Then clicked on the dropdown next to debugger and selected autodetect cdb, and now it works.

    By the way I looked for qt with mingw on the qt site, and it asks you a pile of questions about open source and then it gives you the microsoft open source version whatever you choose. There does not seem to be another version of qt there at all.

  • Well I thought I solved it, but another problem has just happened.
    Now I am getting this error on compile.
    :-1: error: LNK1158: cannot run 'rc.exe'

    So I found some help on stack overflow and it said to copy the rc.exe and rcdll.dll to the microsoft visual studio/VC directory.

    I did this and it still isn't working, so now I can't even compile anything which is really annoying.

    Can anyone give me the link for QT and mingw because every time I download off the main site it only gives me the msvc version.

    I have been to about 20 webpages looking for an answer, and I have copied these files, but still I cannot compile.
    At least before installing cdb I could compile.

  • Lifetime Qt Champion

    If you are using the online installer, then just select the Qt MinGW version as well as MinGW to have everything you need installed.

    If you are using the offline installer, select the one that contains MinGW in its name in this page.

  • @SGaist

    Thanks I am downloading the offline installer of QT and mingw compiler.
    Strange it is only a 32bit version, but at least my app will be backward compatible with 32bit systems.
    I wonder how they managed to hide this page from me this long LOL.

    Will let you know how it goes.

  • That did the trick. It now compiles and the debugger works for a change woo hoo thanks

    PS. since compiling but there is a problem that wasn't there before
    I am using

    QDir databasePath; 
    QString path = databasePath.currentPath()+"/database";

    Which is supposed to put me in the exe folder, but it is ending up iin username/documents instead
    This worked fine before. Hope it isn't a bug in mingw. Looking for a solution now.

    PPS. I have found a solution, but I don't know why my old code which worked before is now not working. There must be differences in the compiler. Anyway this new line works.

    QString path = qApp->applicationDirPath()+"/database";

  • Lifetime Qt Champion

    Not necessarily however, currentPath doesn't mean application executable path, it's the current working directory which might be different.

  • I had the same linking error as @Asimov and managed to get it working with MSVC 64-bit. You need to make rc.exe and rcdll.dll available to the compiler, but since it's a 64-bit project this means using the 64-bit versions and putting them in the right spot.

    For Visual Studio 14 (2015) and Windows kit 8.1, that means copying rc.exe and rcdll.dll from:
    C:\Program Files (x86)\Windows Kits\8.1\bin\x64
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

  • @AliShug No it isn't allowing me to copy those files.... Having the same trouble in one of my computers.

  • I know this is an old post, but I'll just share my solution here.

    Adding to the PATH environment variable this(depending on the windows kit that you're using):
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86

    Or you can do as @AliShug suggested:
    Copying these 2 files: rc.exe and rcdll.dll.
    C:\Program Files (x86)\Windows Kits\8.1\bin\x86
    C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86

Log in to reply