Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Valgrind in QtCreator: console input failing
Forum Updated to NodeBB v4.3 + New Features

Valgrind in QtCreator: console input failing

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Don Slowik
    wrote on last edited by
    #1

    I have a simple HelloWorld type project using QtCreator as a code editor. Here is the source:
    @
    #include <iostream>
    #include <string>

    int main() {
    std::cout << "Hello World!" << std::endl;

    std::cout << "Enter your name: ";
    std::string name;
    std::cin >> name;
    std::cout << "Hello " + name << std::endl;

    return 0;
    }
    @
    If I check the 'Run in terminal' box in the project Run Settings, it Runs fine, opening a separate terminal window(not the Application Output window in QtCreator), which cout/cin happily write/read to/from. If I de-select the aforementioned 'Run in terminal' box, click Run, it opens the Application Output window in QtCreator, writes to it, but is unable to read from it. This is all fine with me -I just make sure to always select 'Run in terminal' for such console applications; GDB and everything runs fine with i/o directing there.

    Now the problem is that when I click 'Analyze', select either Valgrind Memory Analyzer or Valgrind Function Profiler, click the Start button, the Application Output window opens(within QtCreator) rather than the seperate terminal window opening, REGARDLESS of whether I have checked the aforementioned 'Run in terminal' box! So it is again unable to read any user input.
    How to use cout/cin to write/read to/from this simple program running under Valgrind?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Don Slowik
      wrote on last edited by
      #2

      Is cin/cout io not possible while running Valgrind?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        You should try to bring this question to the Qt-Creator mailing list, you'll find there Qt Creator's developers/maintainers. This forum is more user oriented

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved