Running debug mode in Qt Creator - qt

I am trying to compile some demo code (specifically, the pcl_visualizer demo that comes with the Point Cloud library). When running debug by clicking the green arrow with the magnifying class, I get the following errors:
This does not seem to be a "Debug" build.
Setting breakpoints by file name and line number may fail.
Section .debug_info: Not found.
Section .debug_abbrev: Not found.
Section .debug_line: Not found.
Section .debug_str: Not found.
Section .debug_loc: Not found.
Section .debug_range: Not found.
Section .gdb_index: Not found.
Section .note.gnu.build-id: Found.
Section .gnu.hash: Found.
Section .gnu_debuglink: Not found.
Furthermore, none of the breakpoints I have inserted are breaking the program, and they all have little hourglasses hovering over.
In Projects, the Debug mode is selected in Build Settings.
Why does my code not seem to be debugging correctly?

Some projects automatically build debug mode and allow to run it individually. You can then pick it in the bottom left Run selection menu.
Other projects require you to specifically do a debug build.
For example: Kdenlive requires you to run CMake again with the following parameter added:
-DCMAKE_BUILD_TYPE=Debug
You can re-run CMake in the Projects view.

For newer versions of QT:
Go to "Projects" in the top left of the screen, an icon with a wrench that turns green when you select it.
If not already "clicked", click on "Build" under the named Kit (I have "desktop" as my kit). This should be immediately below "Build & Run" on the left side.
Under Build Settings at the top center, should have "Edit build configuration" with a drop down next to it. If you can select "Debug" from the drop down then do it, otherwise click "Add" in the drop down next to it and select "Debug".
Drop down some and see "Key" on the left side of a table of "Key"s with "Value"s, look farther right and see "Advanced" with a square, check the square to get the advanced Key-Value pairs.
Look for "CMAKE_BUILD_TYPE" and click "Edit" in the far right, change the drop down for the value matched to the key CMAKE_BUILD_TYPE to "debug".
Now in the bottom left, change the build configuration to "debug" and build... should work!
You may have to Clean the project and possibly clear cmake configuration under the Build tab.

Another cause for the "does not appear to be a debug build" message is running gdb using the cdb engine. to check go to tools->options->build and run->kits and select the kit you are using. next go to the debugger line, choose edit, and make sure you have the right engine for your debugger.

On linux using the 'Qt Maintenance tool' to install the 'Qt Debug Information Files' solved this for me

I've got the same message because the build type was set to release. On Qt Creator 3.3.0 on the bottom left, on top of the play symbol i have a pc icon with the build type. click on that icon and select debug.
I needed to 'run qmake' too from the menu build.

For nasm users with QT5.9.1 and nasm 2.14 the problem will be gone by using:
nasm -felf64 -FDwarf -g
I know it's not c/c++ related but works very well in QT

To change the Build Configuration in QT Creator :(at time of writing : 4.13.3)
Just make sure you have selected this as Debug so that it would then run in debug mode.

I managed to solve this by unchecking "Warn when debugging Release builds" in the Debug settings General tab, as in the article:
http://www.kdab.com/qt-on-android-episode-2/

Related

How to select building target in QT Creator?

I am trying to set up and run an open source application(LibreCAD) and I am following their Build From Source guide. In section "Building LibreCAD 2.0 on Windows" and under "Building LibreCAD in Qt-Creator" they state this:
Take care about the Shadow build option in Debug and Release
configuration. Disable this option in both configurations and save the
project.
Select librecad as building target in Qt Creator (instead of tff2lff, which is another choice)
If everything is good up to this point, you can build and run LibreCAD
within Qt-Creator.
I could not figure out how or/and where to do the second task. Could anyone help me please?
In Qt - Building for Multiple Platforms they say I need to "1.Click the Build and Run Kit Selector icon" and then to "2.Choose Build > Build Project". But I don't see any Kit Selector icon on my QT compiler!
And in Configuring Projects they say it is right here:
But on mine, it looks like disabled:
Edit:
This is how my "Kit Selector" looks like:
and then to "Choose Build > Build Project"
I'm not sure where you see that, but it's not on either of those pages.
They're talking about this thingy:
The "Build and Run Kit Selector icon" is on the button above the "Run" button (it's probably named like this because running an executable via this button implies that the target is built first).
In your project, tff2lff might be where app is in the screenshot, and librecad might be where test is, for example.

Qt - Qml debugging is enabled. Only use this in a safe environment

I'm trying to run a very simple program that just closes the window when clicking the `exit button, but get the following output provided that the application window that contains the button does not show up:
Starting C:\Users\Ola\Desktop\signal_slot1-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2008__Qt_SDK__Debug\debug\signal_slot1.exe...
Qml debugging is enabled. Only use this in a safe environment!
What should I do in this case?
You have enabled QML debugging (actually it's on by default), this opens a port to the Javascript interpreter that is running the QML so you can get debug output from it. Obviously this creates a security hole, so it should be turned off when not being used in safe place (it's turned off automatically when you release compile). This warning is to remind you of that.
If you are not using QML, turn it off anyway. You can turn it off in the project's options page, where the build settings are (it's a check box in the qmake area).
Assuming you use Qt Creator:
If you select the Release-Build type the QML debugging will be disabled. To do this, select the build type on the bottom left corner above the "run" button and choose "release".
Manually, there is an option passed to qmake (either in the .pro file or via command line arguments) named
CONFIG+=qml_debug
which enables qml debugging.
If you omit that, it should be disabled.
You can change it to release mode if you want to and that would solve the problem
but I recommend you to change between MSVC and MinGW and check which one is going to work.
Project->Build and Run-> and choose what you need.

Qt Creator cannot preview QString when debugging

List item
Qt-Creator 2.2.0
OSX Lion
"Use debugger helpers" is checked
"Built" and "re-built" all the helpers.
Still... break point on method with QString and the content of the QString cannot be previewed on the debugging pane unless I go to the memory window and search for it manually with the address. I have to use qDebug to dump strings out as if we're in 1983. This use to work and I have no idea what happened to it. Every other type works well.
On Windows 7, the debugger can preview QString objects.
Pastebin the debugger log (right pane of Windows->views->Debugger Log) somewhere and post the link here. And perhaps the log file of the debugger helper rebuilding that you tried?
I had the same problem but after some research I found the answer here:
http://silvermace.com/2010/09/qt-creator-debugger-not-displaying-qstring/
I had to chose the correct qmake path and then I had to build the GDB Helper.
As the original site is gone, here are the steps:
sudo rm /usr/local/Qt4.6/qtc-debugging-helper/libgdbmacros.dylib
Start Qt Creator
Qt Creator -> Preferences -> Select the “Qt” tab -> Select “Qt in PATH” under “Auto-detect”
There should be a red cross next to the label “Debugging Helper.” On the right of that there’s a rebuild button – hit it and wait.
The red cross should turn into a green tick.
Clean & Build your project.

How to select debug/release mode in Xcode4? [duplicate]

Build for debug is just press on the PLAY symbol, but I don't know how to Build for distribution/release?
The short answer is:
choose the iOS scheme from the
drop-down near the run button from
the menu bar
choose product > archive in the
window that pops-up
click 'validate'
upon successful validation, click
'submit'
You can use command line tool to build the release version. Next to your project folder, i.e.
$ ls
...
Foo.xcodeproj
...
Type the following build command:
$ xcodebuild -configuration Release
The "play" button is specifically for build and run (or test or profile, etc). The Archive action is intended to build for release and to generate an archive that is suitable for submission to the app store. If you want to skip that, you can choose Product > Build For > Archive to force the release build without actually archiving. To find the built product, expand the Products group in the Project navigator, right-click the product and choose to show in Finder.
That said, you can click and hold the play button for a menu of other build actions (including Build and Archive).
XCode>Product>Schemes>Edit Schemes>Run>Build Configuration
They've bundled all the target/build configuration/debugging options stuff into "schemes". The transition guide has a good explanation.
I have a large app that was having problems uploading to the AppStore using the archive method you will find in XCode 4. The activity indicator kept spinning for hours whether I was trying to validate or distribute, so I created a support ticket to Apple. During that process, I found out you could right click on the .app in your Products folder inside the Project Navigator of XCode, and compress the app to submit using the Application Loader 2.5.1. (aka the old method). Only the Debug - iphoneos folder is accessible this way (for now) and once Apple responded, this is what they had to say:
I'm glad to hear that Application Loader has provided you a viable workaround. Discussing this situation internally, we're not sure that submitting the Debug build will pose too much of a problem (so long as it was signed with the App Store distribution profile, as you mentioned it was). The app will likely be slower as the debug switches are turned on and optimizations are turned off for the Debug configuration, though it will still run. App Review will ultimately determine whether or not that's ok, as I'm not sure that's something they check for. You could try reaching out directly to App Review to confirm this, if you wish. However, since App Loader is working for you, I do recommend rebuilding the app with your Release configuration and resubmitting to play it safe. To find your Release build in Xcode 4.x, control-click on the Application Archive on the Archives tab in the organizer, and choose "Show in Finder." Then, control-click on the .xcarchive file in Finder and choose "Show Package Contents." The release built .app file should be located within the /Products/Applications folder.
This was very helpful information for developers who are having problems with the archive method, and my app is now uploading successfully without any concern that it won't run to the best of it's ability.
To set the build configuration to Debug or Release, choose 'Edit Scheme' from the 'Product' menu.
Then you see a clear choice.
The Apple Transition Guide mentions a button at the top left of the Xcode screen, but I cannot see it in Xcode 4.3.
That part is now located under Schemes. If you edit your schemes you will see that you can set the debug/release/adhoc/distribution build config for each scheme.
Product -> Archive, later, press the distribute button and check the option Export as Application or what you want

Dubuging problem in asp.net?

in my project when i build the project it is giving this message :
To debug this module, change its project build configuration to debug mode. To suppress this message, disable the "Warn inf no user code on launch" debugger option
due to this when i place the break point. break point is not working. can u help me.
Check that the Standard toolbar shows that you are working in Debug mode. This is the most common cause for this problem. This setting controls what mode the Run will use. (Too see this toolbar, right click in the Visual Studio menu area and make sure the 'Standard' toolbar is checked.)
Check that you are not running with ctrl+f5 (which equals Start Without Debugging). This does not match the error message you get, so likely not the answer.
Check that the Solution Configuration does not specify that the project should be built in Release mode. To access this, right click the solution, see properties for the solution and then review the configuration settings for your projects in the configuration dialog editor that pops up.
you're trying to debug your project in Release mode... Switch the project into Debug mode, click Rebuild and then press F5.

Resources