QT with debugger - qt

I am new to QT
I downloaded online installer for QT windows in the location
http://qt.nokia.com/downloads
I just tried simple program like printin hello world.
I Could execute the program. But I am not able to debug it.
I am getting errors like
None of the debugger engines 'Cdb engine, Gdb engine' capable of
debugging binaries of the type 'x86-windows-msvc2008-pe-32bit' is
configured correctly.
Should I download a different version for debugging or Did I miss any procedure to include debuging facility?. Please help me to install QT with debugger.

Do you have Visual Studio installed?
You need to have it installed so you can use this engines to debug.
Here is the link for the Visual studio: LINK
Enjoy!

I had the same problem with QtCreator. An Update of the QtSDK solved it for me. You find the update mechanism in a menu of QtCreator.

Go to Tools -> Options -> Tool Chains, and tell us what you see. I have only ever used Qt with mingw, not Visual Studio, so I don't know if it will help, but look at this question and its resolution.

It looks like there was a bug in QtSDK installer at some point. Firstly, try updating. Secondly, try this:
open Qt Creator and go to Tools → Options... → Build & Run, select Tool Chains tab;
there should be Auto-detected list, select in there Mingw as GCC for Windows targets and click Clone button;
Now select cloned tool chain, you should be able edit specific fields in the bottom;
Click Browse... right to Debugger field and select %QTDIR%\pythongdb\python_2.7based\gdb-i686-pc-mingw32.exe;
Save your edits, create a new project (don't forget to select cloned tool chain) and try debugging.
Does it work?

Related

Cannot step into Qt source

I create a Qt project,build the project with msvc2017-32bit kit, and debug the project in Qt Creator. The problem is I can not step into the Qt functions. I can stop at break-points in my own source code, but cannot stop at break-points in files in Qt src directory. When I step into a Qt function, a message Stopped: "end-stepping-range" appears by the debugging buttons. Why could this happen?
According to #user13088490's suggestion, I installed the debugger tools for windows in windows 10 SDK, but the problem persists.
Follow the instructions from Qt here.
For Mac, the instructions are:
In Projects->Build&Run->Run->Run Settings->Run, select "Use debug version of frameworks".
There are different instructions for Windows, but I have not tried it yet.
You probably also need to have QT sources installed.
Go to the MaintenanceTool and check if Qt Creator 4.15.2 CDB Debugger Support and Debugging Tools for Windows has been selected.
I run Qt on Windows, although a different compiler than you, and you can set the debug target paths by going to Tools->Options->Debugger. From here you can click a button Add Qt sources.... Below is an image of my setup and this works for me.

How do I know which console command Qt is building the project on?

My project unlike this issue is going through MSVC and I'm having troubles with nmake. Is there a way to just see what commands Qt Creator uses when I press Ctrl+R?
Simply click down on the "Compile Output" pane, and it will show you the exact commands that are issued to build the project.

How to permanently disable QML debugger in Qt?

Whenever I make a Qt project, the qmake command includes this parameter:
"CONFIG+=qml_debug"
I never use qml and dont want to manually click three times and ignore the warning every time I generate a new project.
It happened to me in a project. I just added this to the .pro file :
CONFIG -= qml_debug
It seems to work.
You can download Microsoft Visual Studio 2017 Community Edition, it's free to use. And it is not only a great IDE but also it has got Qt support. By downloading Qt plug in for Microsoft Visuals Studio you can create Qt projects and build and debug them...
Everything that you do with Qt Creator and it has got no such problem as yours.
Also if you want to stay with Qt creator, check Projects -> Build & Run -> Run Settings. There is Enable QML setting which mine is disabled. Maybe you can disable it from there.
If not I advice you to check Tools -> Options -> Build & Run and Tools -> Options -> Debuggers. If it can be solved within Qt Creator it must be solved from these places.

Can't make Qt Creator Work

I've downloaded and installed Qt Creator from its online installer and the latest version but when i try to create a Qt Console Application i get the following error. I haven't touched options. The picture is an error from when i tried to open a file from my professor but i get the same error when i try to create a new one. It could be pretty simple but its the 1st time im using this program as a student and have no idea whats going on. Thanks in regards for your timeenter image description here
If you are using Qt Creator with MSVC Compiler (Visual Studio), you need to also download the Visual Studio Compiler. Qt for MSVC doesn't come with a compiler.
It seems that you are trying to compile with VS 2017. You can Download Visual Studio 2017 from: https://www.visualstudio.com/es/downloads/
Express is free, the other two are paid, but don't download VS Code, it's for another purpose.
Alternatively, you can download only the compiler from: http://landinghub.visualstudio.com/visual-cpp-build-tools It's ligther but you don't get the IDE.
Also, for debugging, if you are on x86 or x64, download Windows CDB from: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debugger-download-tools
After you install this, you can reboot Qt and then it will show it has the appropiate compiler and debugger, like this (note that I use VS 2013):
There is another option if you don't want to download or use Visual Studio. Go to the Qt Maintenance Tool (uninstaller), Add or remove components, then install MinGW binaries of your favorite Qt Version, like this:
MinGW is free and it comes bundled with Qt, so you can build and run (and debug!) right away.

Compiler configuration for Qt Creator

I am new to Qt and its IDE Qt Creator so pardon my ignorance.
When I try to compile my code I get the exception
"Qt Creator needs a compiler set up to build. Configure a compiler in the kit options".
I have installed MingGW for compiling C++ code.
However, I am having a problem configuring it for Qt Creator.
Any help will be appreciated. Thanks
I suspect you are using the new 5.0 Qt. It required a bit of prodding for me too.
If you look into Settings > Build & Run > Kits you should see an auto-detected entry which will probably have an exclamation mark in front and is not editable. Ignore this.
Add a new Kit
Give it a name, set the "Qt version" and select a compiler. (Compilers should have been auto-detected. If you do not see any compilers, you will have to set at least one up manually)
Click the "Make Default" button. (You may have to modify project build settings to use the new Kit too)
There may be a better way, but I do not know it. And you should probably use 4.x until 5 is out of beta.
I was also having the same problem, so what I did was this:
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
I then closed the QT Creator, restarted it, and it worked.
I do not know which of the above two made it work, but it worked!
You are using Qt Creator 2.6.x, as those are the only ones that have kits.
Please go to Tools>Options>Build & Run>Compilers and add you mingw compiler there. You need to point creator to 'g++' in your mingw installation.
Then head over to the Kits tab and click on the desktop kit that creator should have created for you. In the details there is a field called Compiler (or Tool chain, don't remember). Select your mingw compiler there. Check the debugger field. If it is empty or using the gdb debugger that is part of mingw: Grab a debugger from http://builds.qt-project.org/, install it and point creator to that one. The debuggers delivered as part of mingw are known to not work well with creator.
Do not use the Nokia Qt SDK: Everything in there is terribly outdated by now!
This is just a starting point to troubleshoot your question, but the Qt Creator preferences has settings in the "Build & Run" area where you can define the location of your build toolchain: compiler, Qt version to build, etc. For mingw you'd have to point the right field to the location of g++, for a Qt version the location of qmake.
Not always the last version is the better. If someone is learning Qt to implement production solutions, is not good idea to use Qt version 5 (see the Qt5 change log). If you want to learn Qt programming, I think that the Nokia SDK is a good starting point, because you only have to install it as another Windows software, and start to coding.
By using linux is another good starting point, because you will have all the develop environment with a few apt-get commands.
When I started programming Qt, I lost a lot of hours to get a complete environment working with QtCreator, and I understand that not everybody has time for it.
I am using Qt Creator 3.5.1 based on Qt 5.5.1. The error "No compiler set in kit" has been a problem every time I have to configure a development system. The solution that worked for me is to select Tools/Options/Compilers and add a compiler. In my case a GCC compiler with Name:g++, Compiler path:/usr/bin/g++. The trick is to add the compiler before trying to add a Kit. If I add a Kit before I add a compiler I can never add the compiler to the Kit. If you having this problem delete the Kit, add a compiler, then add the Kit.
In your questions you must provide us more information about your problem, such as what versions of software are you using.
About your question, I think, that very good idea to you (as a beginner) is to use all-in-box QtSDK (link, need registration). There are ready-to-use QtCreator, MinGW and litle bit old Qt Libs in that QtSDK 1.2.1. So, you dont't need to configure it at all.
Hope, it'll help. Good luck!

Resources