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. Which code I must return?
Forum Update on Monday, May 27th 2025

Which code I must return?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.9k 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.
  • G Offline
    G Offline
    Galiego710
    wrote on last edited by
    #1

    Hi all.

    I have the simple program.
    But, after end of program I have message "During startup program exited with code 0x0".

    The program code is following:
    main.cpp
    @#include <iostream>

    int main(int argc, char *argv[])
    {
    std::cout << "Hello!";
    return 0;
    }@
    test2.pro
    @QT += core
    QT -= gui
    TARGET = test2
    CONFIG += console
    CONFIG -= app_bundle
    TEMPLATE = app
    SOURCES += main.cpp@
    Which code I need returning that there is no error?
    Thanks.


    Best regards,
    Galiego710

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Welcome to this forum.

      In principle you may return any code you like. However, 0 is typically used to indicate that there has been no error encountered. The message you are seeing is a standard information message telling you the return code. It is not an error message and everything is fine.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Galiego710
        wrote on last edited by
        #3

        Thanks, koahnig

        But it looks how an error message.
        Are there any way to avoid this message?

        http://img.flashtux.org/img132df0830e70xb81e77a9.png

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          You are right this looks like an error message. When I read your return code message, I thought it is the standard message you see for some console programs.

          Which operation system are using?

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Galiego710
            wrote on last edited by
            #5

            Operation system is Windows7 (Processor amd64)
            Information from "About Qt Creator"
            Qt Creator 2.3.0 (based on Qt 4.7.4)
            build Aug 25 2011 in 15:26:28
            revision: 0c9dc89d0b

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              That is the output see under Linux built with qt creator

              @Starting ./helloWorld-build-desktop/helloWorld...
              Hello World !
              ./helloWorld-build-desktop/helloWorld exited with code 0 @

              I have tried it also under windows 7 with msvc2005 for a console application you will see only
              @
              Hello World !
              @

              I do not have qt creator installed on windows for cross check.

              The phrase "During start-up " puzzles me a little. I did not see immendiately, but together with the screen shot you have posted, it looks really strange.

              When you change the return to a different value, does it output this new value?

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #7

                The message just states the error code that your code returned. There was no error (otherwise it would say so in the message).

                If we would not give that message in Qt Creator then you had little chance to debug error cases where your application just exists with some error code. This message will not show up when running this application outside Qt Creator.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  Galiego710
                  wrote on last edited by
                  #8
                  • to koahnig:

                  bq. When you change the return to a different value, does it output this new value?

                  Yes, when I return a diffrent values, it show me respective values.

                  • to Tobias Hunger:

                  bq. There was no error (otherwise it would say so in the message).

                  Oh, okay... Simply, I been puzzled the image of the red circle with the white cross.

                  Problem resolved, thanks!

                  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