How to debug in Qt Creator under Windows? - windows

I want to have the same developing environment either in Linux and in Windows so I decided to use Qt Creator. But for some unknown reason I cannot trace my project in Qt Creator under Windows 7. I compile my program as DEBUG target, the resulting executable contains all debug info. After that I press F10 key to step over main function but instead of stepping it just brings program to run. Stepping into via F11 does the same thing.
Firstly I tried gdb shipped with MinGW but Qt Creator refused even to run it complaining that it should be Python capable. After that I have downloaded and installed gdb with Python support from
http://download.qt-project.org/development_releases/prebuilt/gdb/windows-7/qtcreator-gdb-7.4-MINGW32_NT-6.1-i686.tar.gz
as Qt Creator manual recommends but it just made that Qt Creator is able to start the debugger and nothing more, I could not do source level debugging anyway.
Qt Creator under Linux works fine with the same project, it traces, steps and shows the sources Ok. I run MinGW 4.8.1 and Qt Creator 3.1.1 under Windows 7 64bit and the same Qt Creator 3.1.1 version under Fedora Linux 64bit. How can I achieve source level debugging under Windows like under Linux I do?

The best thing is to use Visual studio express compiler and then install the windows debugging tools like specified here and configure qt-creator

Recent GDB builds shipped with MinGW are Python-enabled, and work out-of-the-box in Qt Creator. The link you found seems outdated.

Related

An assert problem on QT in Windows on ARM

I'm using Qt Creator v8.0.1, Qt 6.3.2(MinGW 11.2.0 64-bit), open source version, to develop x64 Windows desktop program and I encountered an assert problem.
Usually, when debugging a program in Qt Creator, if the assert condition in the program is false, the debugger will automatically break at the assert code and we can view calling stack and variables value. If my development environment is on Intel + Windows laptops, which has always been like this.
Recently, I changed to a Mac book Pro M2, equipped Parallel Desktop 18, and installed Windows 11 (on ARM) in Parallel Desktop, and installed Qt Creator v8.0.1, Qt 6.3.2 MinGW 11.2.0 64-bit in windows 11(On ARM). Qt binary is x64 architecure. I debug a program in Qt Creator. If the assert in the program is triggered, I can't view the current function call stack and variable values like I can on Intel+windows environment. Instead, the following message will pop up:
enter image description here
After I click “Retry”, it pops up
enter image description here
It took me a long time to solve this problem,I think it may be that the Qt (x64) debugging function is not adapted well enough on the M2.
Here are some of my attempts:
I installed Visual Studio Community 2022 On ARM in Windows 11 (on ARM) in Parallel Desktop, and Debugging assert works fine in Visual Studio Community 2022.
According to the "(Press Retry to debug the application - JIT must be enabled)" on the dialog, I set Just In Time Debug in Visual Studio, but it doesn't work either.
I set up “GDB Extended” in Qt Creator but it doesn’t work. And it has a great negatively impact on the debugging speed.
I tried to install the Qt for Windows on ARM, bug MinGW 11.2.0 64-bit kit was not supported. (https://doc.qt.io/qt-6/windows.html)
Does anyone know the reason for this problem? Or give some ideas. Thank you.

VS2010 with C++11 all feature support using QT creator

I would like to ask a question about VS2010 IDE environment with all the C++11 features. Currently we need to build our software where some libraries need C++11 all feature support but we are now still running VS2010 environment and currently we are not upgrading our VS2010 to VS2017 at this moment.
So Is there any way to build these library with alternative mentods like installing QT creator on Windows platform so that can use g++ 4.9.3 or later same as on linux ubuntu? I found some website mentioning about Cygwin installed on Windows but seems not clear how to do.
Thanks for your help!
The QT installer provides binary versions built with MinGW as well as MinGW itself, so just use those.

Why these Issues when installing Qt Creator afresh?

After a couple of days of trying to get Qt Creator to build a Windows GUI project I received from a colleague, I decided to remove my previous installation and re-install Qt from a clean slate.
Using the latest "Community" version installer from the Qt website, I selected the Qt toolchain version 5.11.2, including MinGW 5.3.0 32-bit, Qt Sources and Qt Scripts.
I did not select any MS Visual Studio related toolchains. However, on my machine there is an updated VS Community installed.
After installation was done, I started Qt Creator, and before even selecting a project to open, I get these errors reported in the Issues pane (in the image, also is the Help/About popup):
Why does Qt look for the MSVS scripts, and moreover, why is it not able to run cmd.exe as reported by the 1st error. The VS scripts are exactly in the reported path.
How should I eliminate theses errors?

Setting up QtCreator cross compiler for ARM on Windows

I need to develop Qt and command line software for the BeagleBone Black and Raspberry Pi-2. Ideally I wish to use QtCreator as I am accustomed to it, but in any case I need to use QtDesigner for GUI work.
I have spent days trawling through articles, going around in circles and getting nowhere.
The Raspberry Pi-2 has Raspbian/Jessie installed together with Qt 5.2.3. I can design, compile and run Qt desktop applications on this. Of course compilation is slow and not really usable for development work.
To try and keep matters simple, I downloaded qt-opensource-windows-x86-android-5.3.2.exe and installed that on my Windows 7 (64-bit) system. My belief is that this Qt install is the same version as the Qt on the Pi-2 and already contains the ARM7 library files required for cross-compiling. All that should be needed is a cross-compiler for Windows/ARM?
Windows/QtCreator complained in Tools > Options > Qt Versions about the Qt 5.3 for Android armv7 stating "No compiler can produce code for this Qt version...".
For a Windows/ARM cross-compiler I downloaded and installed Yagarto (yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222.exe). I figured I then just need to set the QtCreator compiler path in Tools > Options > Compilers and then things would start working. This is not the case.
Clearly I am missing something important and have managed to become confused by the number of not-quite-relevant articles I have read.
Is Yagarto the cross-compiler I need in this situation?
How do I define the compiler in QtCreator and get rid of the error?
Is there an easier way to set-up this stuff?
Thank you.
Details:
QtCreator 3.2.1 (Qt 5.3.2)
Windows 7 64-bit service pack 1
Edit:
I have just tried again using the GCC ARM Embedded ToolChain and GNU Make for Windows. The result is the same in that I cannot seem to configure the settings for QtCreator ARM7 and make it happy.

using Qt 5.0 with Qt Creator and vs2010 compiler

I recently decided to upgrade from Qt 4.X to 5, though now it has only vs2010 supported. Whenever I start Qt Creator I get that there isn't any compiler (and there are no options in the settings to set one).
Question:
How do I download the vs2010 compiler? Do I have to download vs2010 itself? Will I get a debugger as well?
I have tried this suggestion, but Qt didn't pick up the compiler: Using Visual Studio as a Compiler for QT Creator
Sorry if this question have been asked before, but I have been unable to find a source that explains what I should do.
Seems like you didn't install MSVC yet. Get it from Microsoft website.
Than download sources from Nokia. Unpack them to a new folder e.g C:\QtSources and compile them with MSVC. This instructions are working just fine.
Finally add them to Qt Creator in
Tools -> Options -> Building -> Qt Versions
by poiting to your new qmake executable in
C:\QtSources\bin\qmake.exe
Hope Qt 5 will work with free Express Edition of MSVC.
You shouldn't need to re-compile Qt, as the SDK version is built with msvc2010 32-bit. For debugging, you may need to download the Windows SDK 8. Qt Creator may auto-detect your compiler and debugger, but if not, proceed as follows:
Under Options/Build & Run/Qt Versions, point to qmake.exe
Under Options/Build & Run/Kits, set "Qt Version" to the one you just created, and set your compiler and debugger
The compiler should be auto-detected if it's on your system.
The debugger is something like C:\Program Files\Windows Kits\8.0\Debuggers\x86\cdb.exe.
Good luck!

Resources