Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My First Project Simple Hello World and it doen't run...

My First Project Simple Hello World and it doen't run...

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 361 Views
  • 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.
  • H Offline
    H Offline
    HK__
    wrote on last edited by
    #1

    Hello All,

    I am a complete newbie and started creating my first QT Console app with below code

    #include <QCoreApplication>
    #include <iostream>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        std::cout << "Hello World!";
    
        return a.exec();
    }
    

    It compiles and when running it looks like it is stuck here

    Starting C:\QT_Projects\build-HelloWorld-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\HelloWorld.exe ...

    I am not seeing any console with Hellow World...

    The Kit selected is default one "Desktop QT 5.15.1 MinGW 64-bit"

    Any help will be deeply appreciated.

    jsulmJ J.HilkJ 2 Replies Last reply
    0
    • H HK__

      Hello All,

      I am a complete newbie and started creating my first QT Console app with below code

      #include <QCoreApplication>
      #include <iostream>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
          std::cout << "Hello World!";
      
          return a.exec();
      }
      

      It compiles and when running it looks like it is stuck here

      Starting C:\QT_Projects\build-HelloWorld-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\HelloWorld.exe ...

      I am not seeing any console with Hellow World...

      The Kit selected is default one "Desktop QT 5.15.1 MinGW 64-bit"

      Any help will be deeply appreciated.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #3

      @HK__

      I am not seeing any console with Hellow World...

      If you start this from QtCreator the output will probably redirected to there.

      Go to "Projects" -> Build & Run -> Run -> set a checkbox in "Run in terminal/commandpropt"

      https://doc.qt.io/qtcreator/creator-run-settings.html#specifying-run-settings-for-desktop-device-types


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      H 1 Reply Last reply
      2
      • H HK__

        Hello All,

        I am a complete newbie and started creating my first QT Console app with below code

        #include <QCoreApplication>
        #include <iostream>
        
        int main(int argc, char *argv[])
        {
            QCoreApplication a(argc, argv);
            std::cout << "Hello World!";
        
            return a.exec();
        }
        

        It compiles and when running it looks like it is stuck here

        Starting C:\QT_Projects\build-HelloWorld-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\HelloWorld.exe ...

        I am not seeing any console with Hellow World...

        The Kit selected is default one "Desktop QT 5.15.1 MinGW 64-bit"

        Any help will be deeply appreciated.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #2

        @HK__ said in My First Project Simple Hello World and it doen't run...:

        It compiles and when running it looks like it is stuck here

        It's not stuck, add << std::endl after "Hello World!" string.
        Explanation: stdout is buffered, a.exec() call is blocking, you need to force stdout to print out your string, one way to do so is to add std::endl (newline).

        For debug output you can also use qDebug() << instead of std::cout <<

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        3
        • H HK__

          Hello All,

          I am a complete newbie and started creating my first QT Console app with below code

          #include <QCoreApplication>
          #include <iostream>
          
          int main(int argc, char *argv[])
          {
              QCoreApplication a(argc, argv);
              std::cout << "Hello World!";
          
              return a.exec();
          }
          

          It compiles and when running it looks like it is stuck here

          Starting C:\QT_Projects\build-HelloWorld-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\debug\HelloWorld.exe ...

          I am not seeing any console with Hellow World...

          The Kit selected is default one "Desktop QT 5.15.1 MinGW 64-bit"

          Any help will be deeply appreciated.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #3

          @HK__

          I am not seeing any console with Hellow World...

          If you start this from QtCreator the output will probably redirected to there.

          Go to "Projects" -> Build & Run -> Run -> set a checkbox in "Run in terminal/commandpropt"

          https://doc.qt.io/qtcreator/creator-run-settings.html#specifying-run-settings-for-desktop-device-types


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          H 1 Reply Last reply
          2
          • J.HilkJ J.Hilk

            @HK__

            I am not seeing any console with Hellow World...

            If you start this from QtCreator the output will probably redirected to there.

            Go to "Projects" -> Build & Run -> Run -> set a checkbox in "Run in terminal/commandpropt"

            https://doc.qt.io/qtcreator/creator-run-settings.html#specifying-run-settings-for-desktop-device-types

            H Offline
            H Offline
            HK__
            wrote on last edited by
            #4

            @J-Hilk Thanks. This did the trick.

            1 Reply Last reply
            1

            • Login

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