简体   繁体   中英

Qt debugger input not working

I am trying to learn to debug using Qt Creator on OS X. Some of the exercises I am trying to complete require user input. When run normally the terminal window appears and dialogue works fine. However when run in debugger mode the terminal Windows down not appear and no input can be taken.

I have tried setting a break point and setting the values using the "watches" window (I don't know what it is actually called but that is what Code:: Blocks called it). I have also tried to skip the cin lines using the step over button but that does not work either. I found this answer which seemed similar but it was for Ubuntu and I am on Mac and I have no idea how implement their fix.

Here is an example of my problem:

#include <iostream>
using namespace std;
int main ()
{
     double base_val;
     cout << "Enter a base value: ";
     cin >> base_val;
     //the code cannot go further than this
     cout << base_val;
}

This was done in a plain C++ application with the qmake build system. The Run in terminal option is checked (Projects / Build & Run /Run)

I managed it to get it running on the qt creator and also with code::blocks but on arch linux - should work in windows and mac osx similar.

I installed gdb first but that is a Linux thing - windows and mac should have all on board ready installed with both editors. (yay -S gdb:)

3 extra/gdb 8.3.1-1 (3.8 MiB 9.7 MiB) (Installed)
    The GNU Debugger

On Code::Blocks activate Debug->Debugging Windows->[x] Watches On the qt creator it is shown after hitting F5 or Debug->Start Debugging->Start Debugging of Startup Project F5 on the right hand side named name | value

Both programs creates the same messages, took me a while - I hope that safes you guys time or helps you out if you never found it to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM