Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    QT exited with code -1073741510

    General and Desktop
    5
    14
    3858
    Loading More Posts
    • 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.
    • F
      foxgod last edited by

      i create a console program,but when i close console program or ctrl+c, QT displays exited with code -1073741510 ,why? where is wrong?

      @int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);
      qDebug()<<"hello qt";
      return a.exec();
      }@

      qxoz:code tags

      1 Reply Last reply Reply Quote 0
      • A
        ankursaxena last edited by

        Good question .. !! BTW.. There is nothing wrong in that. but i also want to know what is that number which written in "exited with code -1073741510".

        1 Reply Last reply Reply Quote 0
        • A
          andreyc last edited by

          -1073741510 = 0xc000013a

          According to "NTSTATUS values":http://msdn.microsoft.com/en-us/library/cc704588.aspx it is

          @
          0xC000013A
          STATUS_CONTROL_C_EXIT

          {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.
          @

          1 Reply Last reply Reply Quote 0
          • F
            foxgod last edited by

            3Q

            1 Reply Last reply Reply Quote 0
            • JKSH
              JKSH Moderators last edited by

              You don't need an event loop, so don't call exec().

              @
              // Replace this...
              return a.exec();

              // ...with this:
              return 0;
              @

              If you call exec(), you need to quit your program by triggering QCoreApplication::exit() or QCoreApplication::quit()

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply Reply Quote 0
              • F
                foxgod last edited by

                // Replace this...
                return a.exec();

                // ...with this:
                return 0;

                but how can i get i get terminate message from QCoreApplication::notify() or else method.

                1 Reply Last reply Reply Quote 0
                • jeremy_k
                  jeremy_k last edited by

                  I don't think QCoreApplication::notify(), which is used to deliver events, is what you want.

                  There's a QCoreApplication::aboutToQuit() signal that indicates that the main event loop is about to terminate, which works pretty well for applications that end main() with "return app.exec();" Minus an event loop, much of Qt won't be of use.

                  Perhaps a function that uses printf() and is registered with atexit() will work.

                  Asking a question about code? http://eel.is/iso-c++/testcase/

                  1 Reply Last reply Reply Quote 0
                  • JKSH
                    JKSH Moderators last edited by

                    [quote author="foxgod" date="1402987828"]but how can i get i get terminate message from QCoreApplication::notify() or else method.[/quote]What do you want to do with the message?

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply Reply Quote 0
                    • F
                      foxgod last edited by

                      i want to get console close's message ,when i know the console is closed,then i want to execute some program.

                      1 Reply Last reply Reply Quote 0
                      • F
                        foxgod last edited by

                        @void terminateTest()
                        {
                        qDebug()<<"program is over"<<endl;
                        rootThreadpro.aboutToQuit();
                        }

                        int main(int argc, char *argv[])
                        {
                        QCoreApplication a(argc, argv);

                        qDebug()<<"Root\n";
                        atexit(terminateTest);
                        rootThreadpro.StartServer(); 
                        return a.exec&#40;&#41;;
                        

                        }
                        @

                        this can solve currently question , antthing also?

                        1 Reply Last reply Reply Quote 0
                        • JKSH
                          JKSH Moderators last edited by

                          [quote author="foxgod" date="1402989786"]i want to get console close's message ,when i know the console is closed,then i want to execute some program.[/quote]You cannot get that message in your application. When you close the console, it terminates your application.

                          Just launch your other program before return 0;

                          I don't recommend closing a console application by clicking the 'X' or Ctrl-C. If your program terminates like this, it won't be able to clean up. Sometimes, this can corrupt your data files.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          1 Reply Last reply Reply Quote 0
                          • jeremy_k
                            jeremy_k last edited by

                            It looks like atexit() won't work without some additional handling.

                            bq. Functions registered using atexit() (and on_exit(3)) are not called if a process terminates abnormally because of the delivery of a signal.

                            Asking a question about code? http://eel.is/iso-c++/testcase/

                            1 Reply Last reply Reply Quote 0
                            • JKSH
                              JKSH Moderators last edited by

                              Like I said, do not use Ctrl-C, and do not close your console by clicking the 'X'. These are dangerous ways to stop a program.

                              Why don't you quit your program properly?

                              Or, if you really want to close by clicking the 'X', create a QWidget-based GUI. Then, when you click the 'X', you will get a QCloseEvent.

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              1 Reply Last reply Reply Quote 0
                              • jeremy_k
                                jeremy_k last edited by

                                Sometimes users do unexpected things.

                                Asking a question about code? http://eel.is/iso-c++/testcase/

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post