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 283 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 25 Mar 2021, 08:51 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.

    J J 2 Replies Last reply 25 Mar 2021, 08:53
    0
    • H HK__
      25 Mar 2021, 08:51

      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 Online
      J Online
      J.Hilk
      Moderators
      wrote on 25 Mar 2021, 08:55 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 25 Mar 2021, 09:01
      2
      • H HK__
        25 Mar 2021, 08:51

        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 Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 25 Mar 2021, 08:53 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__
          25 Mar 2021, 08:51

          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 Online
          J Online
          J.Hilk
          Moderators
          wrote on 25 Mar 2021, 08:55 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 25 Mar 2021, 09:01
          2
          • J J.Hilk
            25 Mar 2021, 08:55

            @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 25 Mar 2021, 09:01 last edited by
            #4

            @J-Hilk Thanks. This did the trick.

            1 Reply Last reply
            1

            2/4

            25 Mar 2021, 08:53

            • Login

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