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. Crash when run in Release mode?
Forum Updated to NodeBB v4.3 + New Features

Crash when run in Release mode?

Scheduled Pinned Locked Moved Solved General and Desktop
36 Posts 7 Posters 8.5k Views 2 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.
  • M Offline
    M Offline
    Mucip
    wrote on 22 Apr 2020, 11:19 last edited by
    #1

    Hi,
    My program run in debug mode without any crash but when I run it release mode then rash message appear.
    I clean and delete all build directory but nothing changes?! :(
    Any advice?

    14:15:46: Starting D:\Belgeler\Qt\build-mriERP-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\release\mriERP.exe ...
    14:15:46: The program has unexpectedly finished.
    14:15:46: The process was ended forcefully.
    14:15:46: D:\Belgeler\Qt\build-mriERP-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\release\mriERP.exe crashed.
    

    Regards,
    Mucip:)

    J 1 Reply Last reply 22 Apr 2020, 11:28
    0
    • M Offline
      M Offline
      mzimmers
      wrote on 23 Apr 2020, 17:20 last edited by
      #22

      The first thing I'd check is, did the files copy over to the release directory?

      I was making an assumption that you had those files available in your source directory; if not, then you need to furnish the pathnames in the .pro file.

      M 1 Reply Last reply 23 Apr 2020, 17:52
      0
      • M Mucip
        22 Apr 2020, 11:19

        Hi,
        My program run in debug mode without any crash but when I run it release mode then rash message appear.
        I clean and delete all build directory but nothing changes?! :(
        Any advice?

        14:15:46: Starting D:\Belgeler\Qt\build-mriERP-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\release\mriERP.exe ...
        14:15:46: The program has unexpectedly finished.
        14:15:46: The process was ended forcefully.
        14:15:46: D:\Belgeler\Qt\build-mriERP-Desktop_Qt_5_14_2_MSVC2017_64bit-Release\release\mriERP.exe crashed.
        

        Regards,
        Mucip:)

        J Offline
        J Offline
        JonB
        wrote on 22 Apr 2020, 11:28 last edited by
        #2

        @Mucip
        You will (probably) have a bug in code which happens to show up in Release but not in Debug. This has been discussed before in this forum, e.g. uninitialised variable. It happens. Can be hard to trace down.

        Try running your Release executable under debugger. When it crashes inside debugger you still get trace back. If you are lucky, and it can see your source code, you may get enough to see where it is happening....

        M 1 Reply Last reply 22 Apr 2020, 11:31
        1
        • J JonB
          22 Apr 2020, 11:28

          @Mucip
          You will (probably) have a bug in code which happens to show up in Release but not in Debug. This has been discussed before in this forum, e.g. uninitialised variable. It happens. Can be hard to trace down.

          Try running your Release executable under debugger. When it crashes inside debugger you still get trace back. If you are lucky, and it can see your source code, you may get enough to see where it is happening....

          M Offline
          M Offline
          Mucip
          wrote on 22 Apr 2020, 11:31 last edited by
          #3

          Hi @JonB,
          The code was running Qt 5.13 without any problem. But I use on new computer Qt 5..14.2 now and I got this crash unfotunatelly.
          May it be because of VS 2019 new update?...

          How can I run release executable under debuger?

          Regards,
          Mucip:)

          J J 2 Replies Last reply 22 Apr 2020, 11:37
          0
          • M Mucip
            22 Apr 2020, 11:31

            Hi @JonB,
            The code was running Qt 5.13 without any problem. But I use on new computer Qt 5..14.2 now and I got this crash unfotunatelly.
            May it be because of VS 2019 new update?...

            How can I run release executable under debuger?

            Regards,
            Mucip:)

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 22 Apr 2020, 11:37 last edited by
            #4

            @Mucip said in Crash when run in Release mode?:

            How can I run release executable under debuger?

            In the same way you run a debug build

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

            M 1 Reply Last reply 22 Apr 2020, 11:51
            0
            • J jsulm
              22 Apr 2020, 11:37

              @Mucip said in Crash when run in Release mode?:

              How can I run release executable under debuger?

              In the same way you run a debug build

              M Offline
              M Offline
              Mucip
              wrote on 22 Apr 2020, 11:51 last edited by
              #5

              @jsulm ,
              If I press debug button in release uild than I got below error?

              cd6fef54-8206-4234-9cbd-ef5d9eb8ef83-resim.png

              Regards,
              Mucip:)

              J J 2 Replies Last reply 22 Apr 2020, 11:59
              0
              • M Mucip
                22 Apr 2020, 11:51

                @jsulm ,
                If I press debug button in release uild than I got below error?

                cd6fef54-8206-4234-9cbd-ef5d9eb8ef83-resim.png

                Regards,
                Mucip:)

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 22 Apr 2020, 11:59 last edited by
                #6

                @Mucip So, does your app even start in release mode? Or is it crashing before even showing?
                If the latter then probably some libs are not found for release build.

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

                1 Reply Last reply
                1
                • M Mucip
                  22 Apr 2020, 11:31

                  Hi @JonB,
                  The code was running Qt 5.13 without any problem. But I use on new computer Qt 5..14.2 now and I got this crash unfotunatelly.
                  May it be because of VS 2019 new update?...

                  How can I run release executable under debuger?

                  Regards,
                  Mucip:)

                  J Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 22 Apr 2020, 12:13 last edited by
                  #7

                  @Mucip said in Crash when run in Release mode?:

                  VS 2019

                  MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?


                  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.

                  M 4 Replies Last reply 22 Apr 2020, 12:15
                  0
                  • M Mucip
                    22 Apr 2020, 11:51

                    @jsulm ,
                    If I press debug button in release uild than I got below error?

                    cd6fef54-8206-4234-9cbd-ef5d9eb8ef83-resim.png

                    Regards,
                    Mucip:)

                    J Offline
                    J Offline
                    JonB
                    wrote on 22 Apr 2020, 12:14 last edited by
                    #8

                    @Mucip
                    Forget the boxes for a second. You show the release one crashed. Did it not stop in debugger at that point and allow you to see traceback?

                    M 1 Reply Last reply 22 Apr 2020, 12:19
                    0
                    • J J.Hilk
                      22 Apr 2020, 12:13

                      @Mucip said in Crash when run in Release mode?:

                      VS 2019

                      MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?

                      M Offline
                      M Offline
                      Mucip
                      wrote on 22 Apr 2020, 12:15 last edited by
                      #9

                      @J-Hilk ,
                      I did not do extra things when I install VS2019. How will I update MSVC2019?

                      Regards,
                      Mucip:)

                      1 Reply Last reply
                      0
                      • J JonB
                        22 Apr 2020, 12:14

                        @Mucip
                        Forget the boxes for a second. You show the release one crashed. Did it not stop in debugger at that point and allow you to see traceback?

                        M Offline
                        M Offline
                        Mucip
                        wrote on 22 Apr 2020, 12:19 last edited by
                        #10

                        @JonB ,
                        In debugger mode the debug button works well as below screenshot

                        b3c53fdd-c88a-4e5a-ae97-d0fe07852fc6-resim.png

                        Regards,
                        Mucip:)

                        1 Reply Last reply
                        0
                        • J J.Hilk
                          22 Apr 2020, 12:13

                          @Mucip said in Crash when run in Release mode?:

                          VS 2019

                          MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?

                          M Offline
                          M Offline
                          Mucip
                          wrote on 22 Apr 2020, 12:31 last edited by
                          #11

                          @J-Hilk
                          Something wrong in VS2019 I guess too :(

                          No solution untill now. Should I install VS2017???

                          Regards,
                          Mucip:)

                          1 Reply Last reply
                          0
                          • J J.Hilk
                            22 Apr 2020, 12:13

                            @Mucip said in Crash when run in Release mode?:

                            VS 2019

                            MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?

                            M Offline
                            M Offline
                            Mucip
                            wrote on 22 Apr 2020, 13:55 last edited by
                            #12

                            @J-Hilk ,
                            How can I check it please?

                            Regards,
                            Mukcip:)

                            1 Reply Last reply
                            0
                            • J J.Hilk
                              22 Apr 2020, 12:13

                              @Mucip said in Crash when run in Release mode?:

                              VS 2019

                              MSVC is not fully supported with Qt ( 2017 is) I've run into 1 or 2 error because of that as well. Did you update/use the latest MSVC when you installed VS2019 or did you check that?

                              M Offline
                              M Offline
                              Mucip
                              wrote on 23 Apr 2020, 11:00 last edited by Mucip
                              #13

                              @J-Hilk ,
                              It's very strange!

                              When I build in RELEASE mode I got crash and can not run under Qt Creator!
                              But when I run windployqt and create executable of the project than it works without any problem!
                              I can connect to PostgreSQL and use LimeReport and QtZint. I mean all the DLL's work without any problem.

                              Project can be compiled in the release directory but can not be run via Qt... :(

                              Well, Where should be the problem?! I guess Qt must update something according to actual version of VS2019... :(

                              Regards,
                              Mucip:)

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mzimmers
                                wrote on 23 Apr 2020, 13:33 last edited by
                                #14

                                I encounter this every so often. The cause is usually what JSulm suggested -- a missing library. If your project file isn't too big, I'd be interested in looking at it.

                                One thing I do when I encounter this, is go to the release directory and try to run the .exe directly (outside of Creator). You'll likely get an error message telling you what's wrong (eg, which library is missing).

                                M 1 Reply Last reply 23 Apr 2020, 15:06
                                1
                                • M mzimmers
                                  23 Apr 2020, 13:33

                                  I encounter this every so often. The cause is usually what JSulm suggested -- a missing library. If your project file isn't too big, I'd be interested in looking at it.

                                  One thing I do when I encounter this, is go to the release directory and try to run the .exe directly (outside of Creator). You'll likely get an error message telling you what's wrong (eg, which library is missing).

                                  M Offline
                                  M Offline
                                  Mucip
                                  wrote on 23 Apr 2020, 15:06 last edited by
                                  #15

                                  Hi @mzimmers ,
                                  If some DLL is misssing, It shouldn't be compiled. But QtCretator can compile the project.
                                  Am I rigt?
                                  By the way it shouldn't run in DEBUG mode either.

                                  P.S. Thanks a lot for your kind interest. Project is liitle bit long. :)

                                  Regards,
                                  Mucip:)

                                  M 1 Reply Last reply 23 Apr 2020, 15:11
                                  0
                                  • M Mucip
                                    23 Apr 2020, 15:06

                                    Hi @mzimmers ,
                                    If some DLL is misssing, It shouldn't be compiled. But QtCretator can compile the project.
                                    Am I rigt?
                                    By the way it shouldn't run in DEBUG mode either.

                                    P.S. Thanks a lot for your kind interest. Project is liitle bit long. :)

                                    Regards,
                                    Mucip:)

                                    M Offline
                                    M Offline
                                    mzimmers
                                    wrote on 23 Apr 2020, 15:11 last edited by
                                    #16

                                    @Mucip it's not that the .dll is missing - it's just not accessible to the release image. (I'm probably not the best one to explain this.) This would be a useful experiment: go into your build directory for your debug build. Find the executable and try to run it (this should work). Then go into the build directory for your release build, and do the same thing. I'm expecting you'll get an error message from the binary; if so, please post it.

                                    M 1 Reply Last reply 23 Apr 2020, 15:21
                                    0
                                    • M mzimmers
                                      23 Apr 2020, 15:11

                                      @Mucip it's not that the .dll is missing - it's just not accessible to the release image. (I'm probably not the best one to explain this.) This would be a useful experiment: go into your build directory for your debug build. Find the executable and try to run it (this should work). Then go into the build directory for your release build, and do the same thing. I'm expecting you'll get an error message from the binary; if so, please post it.

                                      M Offline
                                      M Offline
                                      Mucip
                                      wrote on 23 Apr 2020, 15:21 last edited by
                                      #17

                                      Dear @mzimmers ,
                                      Well, I tested in DEBUG directory. Clicked MriERP.exe file. Ofcourse it says LimeReport, QtZint and QtCore and etc files are missing. When I copy these files in the debug directory I can run the program in DEBUG folder.

                                      When I try same thing in RELEASE folder, error messages are the same. Same files are missing. I copied LimeReport, QtZint and Qt's DLL files than MriERP.exe files worked normally too.

                                      A quick question: If some DLL are missing It shouldn't compile the project, should it?...

                                      Regards,
                                      Mucip:)

                                      J 1 Reply Last reply 24 Apr 2020, 04:58
                                      0
                                      • M Offline
                                        M Offline
                                        mzimmers
                                        wrote on 23 Apr 2020, 15:32 last edited by
                                        #18

                                        Thanks for running those tests. I misspoke when I said the debug version should run; I forgot that the libraries aren't available outside of Creator. Since you probably don't intend to run your debug version outside of Qt, that's not important.

                                        To fix your release build, you need to do (at least) two things:

                                        1. tell Creator which files (the ones you mentioned)you want to copy to your build directory. This can be done like this (in your .pro file):
                                        my_release.files = "libexpat.lib"
                                        my_release.path = $$OUT_PWD
                                        
                                        INSTALLS += my_release
                                        
                                        1. in your build settings, you need to add a step after make, to do a make install. This will copy the files for you.
                                          build.PNG

                                        This should not work, but might not be exactly what you want. The user can run your program out of the release directory, but if he moves the executable, it won't run. If this presents a problem, let me know, and I'll tell you how to fix this (but it will take you some time to do so).

                                        M 1 Reply Last reply 23 Apr 2020, 16:23
                                        0
                                        • M mzimmers
                                          23 Apr 2020, 15:32

                                          Thanks for running those tests. I misspoke when I said the debug version should run; I forgot that the libraries aren't available outside of Creator. Since you probably don't intend to run your debug version outside of Qt, that's not important.

                                          To fix your release build, you need to do (at least) two things:

                                          1. tell Creator which files (the ones you mentioned)you want to copy to your build directory. This can be done like this (in your .pro file):
                                          my_release.files = "libexpat.lib"
                                          my_release.path = $$OUT_PWD
                                          
                                          INSTALLS += my_release
                                          
                                          1. in your build settings, you need to add a step after make, to do a make install. This will copy the files for you.
                                            build.PNG

                                          This should not work, but might not be exactly what you want. The user can run your program out of the release directory, but if he moves the executable, it won't run. If this presents a problem, let me know, and I'll tell you how to fix this (but it will take you some time to do so).

                                          M Offline
                                          M Offline
                                          Mucip
                                          wrote on 23 Apr 2020, 16:23 last edited by
                                          #19

                                          @mzimmers said in Crash when run in Release mode?:

                                          my_release.files = "libexpat.lib"
                                          my_release.path = $$OUT_PWD

                                          INSTALLS += my_release

                                          Hi,
                                          How can I put two dll files in the my_release.files? Should I add path also?

                                          By the way, what is changed after Qt 5.13.2? I didn't make this modification before? Why it happend in Qt 5.14.2?

                                          By the way if I copy LimeReport.dll and QtZint.dll to RELEASE folder, I can run the program in Qt Creator. This mean the problem was LimeReport.dll and QtZint.dll files missing!

                                          But why? It was working in Qt5.13.2 before???

                                          Regards,
                                          Mucip:)

                                          M 1 Reply Last reply 23 Apr 2020, 16:56
                                          0
                                          • M Mucip
                                            23 Apr 2020, 16:23

                                            @mzimmers said in Crash when run in Release mode?:

                                            my_release.files = "libexpat.lib"
                                            my_release.path = $$OUT_PWD

                                            INSTALLS += my_release

                                            Hi,
                                            How can I put two dll files in the my_release.files? Should I add path also?

                                            By the way, what is changed after Qt 5.13.2? I didn't make this modification before? Why it happend in Qt 5.14.2?

                                            By the way if I copy LimeReport.dll and QtZint.dll to RELEASE folder, I can run the program in Qt Creator. This mean the problem was LimeReport.dll and QtZint.dll files missing!

                                            But why? It was working in Qt5.13.2 before???

                                            Regards,
                                            Mucip:)

                                            M Offline
                                            M Offline
                                            mzimmers
                                            wrote on 23 Apr 2020, 16:56 last edited by
                                            #20

                                            @Mucip

                                            target.path = $$OUT_PWD
                                            target.files = "LimeReport.dll" "QtZint.dll"
                                            INSTALLS += target
                                            

                                            This link OUT_PWD will explain how it works.

                                            Just make sure to add the install step to your build. Adding this stuff to the .pro files is just specifying what the install will work on.

                                            I can't answer why it worked in 5.13.

                                            M 1 Reply Last reply 23 Apr 2020, 17:17
                                            0

                                            1/36

                                            22 Apr 2020, 11:19

                                            • Login

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