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. QT exited with code -1073741510
Forum Updated to NodeBB v4.3 + New Features

QT exited with code -1073741510

Scheduled Pinned Locked Moved General and Desktop
14 Posts 5 Posters 4.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.
  • F Offline
    F Offline
    foxgod
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      ankursaxena
      wrote on last edited by
      #2

      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
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #3

        -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
        0
        • F Offline
          F Offline
          foxgod
          wrote on last edited by
          #4

          3Q

          1 Reply Last reply
          0
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            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
            0
            • F Offline
              F Offline
              foxgod
              wrote on last edited by
              #6

              // 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
              0
              • jeremy_kJ Offline
                jeremy_kJ Offline
                jeremy_k
                wrote on last edited by
                #7

                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
                0
                • JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  [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
                  0
                  • F Offline
                    F Offline
                    foxgod
                    wrote on last edited by
                    #9

                    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
                    0
                    • F Offline
                      F Offline
                      foxgod
                      wrote on last edited by
                      #10

                      @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
                      0
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #11

                        [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
                        0
                        • jeremy_kJ Offline
                          jeremy_kJ Offline
                          jeremy_k
                          wrote on last edited by
                          #12

                          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
                          0
                          • JKSHJ Offline
                            JKSHJ Offline
                            JKSH
                            Moderators
                            wrote on last edited by
                            #13

                            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
                            0
                            • jeremy_kJ Offline
                              jeremy_kJ Offline
                              jeremy_k
                              wrote on last edited by
                              #14

                              Sometimes users do unexpected things.

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

                              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