Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Trying to run default QT Plain C++ App -> -1073741515
Forum Updated to NodeBB v4.3 + New Features

Trying to run default QT Plain C++ App -> -1073741515

Scheduled Pinned Locked Moved Solved Installation and Deployment
21 Posts 4 Posters 8.2k 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
    ghost23
    wrote on last edited by
    #1

    Hello,

    complete newby here, I am using QT, version 5.9.1 for Windows. I installed it with the standard settings.

    Then I created a "Plain C++ application" with the "Desktop Qt 5.9.1 MSVC2015 64bit" Kit (the only available one), which then creates a simple main.cpp:

    #include <iostream>
    
    using namespace std;
    
    int main() {
       cout << "Hello World!" << endl;
       return 0;
    }
    

    When I then press Ctrl+R, a console window opens, but it only says, I should press Return to close the window, no Hello World.

    In the output panel in QT I read:

    Starting C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe...
    C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe exited with code -1073741515
    

    Which, as I already found out, implies, that some library is missing. Shouldn't QT have configured the necessary dependencies? What am I missing?

    I already read here in the forum that some paths have to be added in the PATH environment variable. I do wonder, why the installer of QT did not add those, but anyway. I added the two bin paths, which I found in the Qt installation folder to the PATH environment variable, but it didn't change the outcome:

    C:\Qt\5.9.1\msvc2015_64\bin
    C:\Qt\5.9.1\winrt_x64_msvc2017\bin
    

    I am confused that not even the default project is running on its own after a plain Qt installation.

    jsulmJ 1 Reply Last reply
    0
    • G Offline
      G Offline
      ghost23
      wrote on last edited by
      #19

      Hi,

      ok, so this took some time. Yesterday I found, that I had installed a mess of Microsoft and Windows SDKs and I thought, let's clean this up. So I uninstalled all those SDKs. Then I read the Qt documentation again and it says, that I should install a compiler as a requirement for Qt. One of the recommendations is to use Visual C++ build tools. So I have installed the Visual C++ Build Tools 2015.

      Then I start Qt, but I cannot compile my plain c++ app in Debug mode, because Qt cannot find a debugger. After some investigation, I find, that the Visual C++ build tools 2015 do not contain a debugger. Why isn't that mentioned in the documentation?

      So after somer further googling I find, that the Windows SDK comes with a debugger (the cdb.exe). So I install the Windows SDK. Now I have a debugger.

      Then, when I tried compile my app in debug mode, I got this error:

      LINK : fatal error LNK1158: cannot run 'rc.exe'
      

      So, for some reason, the place, where the rc.exe is, wasn't in my PATH. Added it, now finally, I can compile both the debug and the release version and run them without errors.

      Man, I have to say, I haven't even written one line of code as of now, but I am already exhausted.

      Thanks for all the help, though. Much appreciated.

      J.HilkJ jsulmJ 2 Replies Last reply
      0
      • hskoglundH Online
        hskoglundH Online
        hskoglund
        wrote on last edited by
        #2

        Hi, that error means some DLL was not found (or the wrong kind was found, i.e. without debugging information).

        You can try to compile your app in release mode.
        Also test by opening a CMD window and manually try to start your program, for example:
        C:>C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe

        P.S. No changes or editing of the PATH environment variable is needed for Qt to work.

        J.HilkJ 1 Reply Last reply
        1
        • G Offline
          G Offline
          ghost23
          wrote on last edited by
          #3

          Hi,

          thanks for the hints. So I opened a CMD window and tried to run plainConsole.exe manually. An error window pops up and says, that the 'ucrtbased.dll' is missing. I cannot find such a file anywhere on my computer.

          I also compiled my project in release mode. I switched to release mode and pressed Ctrl+R again. This time in the opened console window I see the "Hello World" and in the out panel it says, that the application ended with code 0.

          So does this mean, that only my debug configuration is somehow broken?

          hskoglundH 1 Reply Last reply
          0
          • hskoglundH hskoglund

            Hi, that error means some DLL was not found (or the wrong kind was found, i.e. without debugging information).

            You can try to compile your app in release mode.
            Also test by opening a CMD window and manually try to start your program, for example:
            C:>C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe

            P.S. No changes or editing of the PATH environment variable is needed for Qt to work.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #4

            @hskoglund said in Trying to run default QT Plain C++ App -> -1073741515:

            P.S. No changes or editing of the PATH environment variable is needed for Qt to work.

            Thats actually not always true, I for example had to add the MSVC Debugger manually for 5.9.1 in the project settings


            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.

            hskoglundH jsulmJ 2 Replies Last reply
            0
            • J.HilkJ J.Hilk

              @hskoglund said in Trying to run default QT Plain C++ App -> -1073741515:

              P.S. No changes or editing of the PATH environment variable is needed for Qt to work.

              Thats actually not always true, I for example had to add the MSVC Debugger manually for 5.9.1 in the project settings

              hskoglundH Online
              hskoglundH Online
              hskoglund
              wrote on last edited by
              #5

              @J.Hilk Yeah you're right, debuggers needs that.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                ghost23
                wrote on last edited by
                #6

                Correction,

                eventually Windows did find multiple instances of the ucrtbased.dll. They are located in the C:\Programs and C:\Programs (x86)\ folders and there deep in the Microsoft SDKs and Windows Kits folders respectively.

                1 Reply Last reply
                0
                • G ghost23

                  Hi,

                  thanks for the hints. So I opened a CMD window and tried to run plainConsole.exe manually. An error window pops up and says, that the 'ucrtbased.dll' is missing. I cannot find such a file anywhere on my computer.

                  I also compiled my project in release mode. I switched to release mode and pressed Ctrl+R again. This time in the opened console window I see the "Hello World" and in the out panel it says, that the application ended with code 0.

                  So does this mean, that only my debug configuration is somehow broken?

                  hskoglundH Online
                  hskoglundH Online
                  hskoglund
                  wrote on last edited by
                  #7

                  @ghost23 'ucrtbased.dll' should be there in your C:\Windows\System32 folder, it's a part of the MSVC2015 installation.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    ghost23
                    wrote on last edited by
                    #8

                    OK, so now that I found those DLLs, what should I do next?

                    hskoglundH 1 Reply Last reply
                    0
                    • G ghost23

                      OK, so now that I found those DLLs, what should I do next?

                      hskoglundH Online
                      hskoglundH Online
                      hskoglund
                      wrote on last edited by hskoglund
                      #9

                      @ghost23 Since ucrtbased.dll is in C:\WIndows\System32, which always in hardwired into the PATH env. variable, no further action should be needed.
                      But since it fails, try doing the exact same thing inside your Visual Studio 2015, i.e. building a simple 64-bit console app in debug mode. It should fail in the same way in Visual Studio...

                      Edit: forgot to mention, also try disabling your anti-virus program (if you have one).

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        ghost23
                        wrote on last edited by
                        #10

                        Hi,

                        well, as I said above, the ucrtbased.dll is not in my System32 folder, but in a subfolder in C:\Program Files(x86)\Windows Kits...

                        I also tried disabling my anti-virus program, but it didn't make a difference.

                        hskoglundH 1 Reply Last reply
                        0
                        • G ghost23

                          Hello,

                          complete newby here, I am using QT, version 5.9.1 for Windows. I installed it with the standard settings.

                          Then I created a "Plain C++ application" with the "Desktop Qt 5.9.1 MSVC2015 64bit" Kit (the only available one), which then creates a simple main.cpp:

                          #include <iostream>
                          
                          using namespace std;
                          
                          int main() {
                             cout << "Hello World!" << endl;
                             return 0;
                          }
                          

                          When I then press Ctrl+R, a console window opens, but it only says, I should press Return to close the window, no Hello World.

                          In the output panel in QT I read:

                          Starting C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe...
                          C:\Users\user\QTProjects\build-plainConsole-Desktop_Qt_5_9_1_MSVC2015_64bit-Debug\debug\plainConsole.exe exited with code -1073741515
                          

                          Which, as I already found out, implies, that some library is missing. Shouldn't QT have configured the necessary dependencies? What am I missing?

                          I already read here in the forum that some paths have to be added in the PATH environment variable. I do wonder, why the installer of QT did not add those, but anyway. I added the two bin paths, which I found in the Qt installation folder to the PATH environment variable, but it didn't change the outcome:

                          C:\Qt\5.9.1\msvc2015_64\bin
                          C:\Qt\5.9.1\winrt_x64_msvc2017\bin
                          

                          I am confused that not even the default project is running on its own after a plain Qt installation.

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11

                          @ghost23 You should not add anything to PATH - it is not needed!
                          It should work.
                          You're using QtCreator?

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

                          1 Reply Last reply
                          0
                          • J.HilkJ J.Hilk

                            @hskoglund said in Trying to run default QT Plain C++ App -> -1073741515:

                            P.S. No changes or editing of the PATH environment variable is needed for Qt to work.

                            Thats actually not always true, I for example had to add the MSVC Debugger manually for 5.9.1 in the project settings

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #12

                            @J.Hilk said in Trying to run default QT Plain C++ App -> -1073741515:

                            Thats actually not always true, I for example had to add the MSVC Debugger manually for 5.9.1 in the project settings

                            But for that you do not need PATH, right?

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

                            J.HilkJ 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @J.Hilk said in Trying to run default QT Plain C++ App -> -1073741515:

                              Thats actually not always true, I for example had to add the MSVC Debugger manually for 5.9.1 in the project settings

                              But for that you do not need PATH, right?

                              J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #13

                              @jsulm Nope. you need to add the Windows(10) Kit binary folder to the Path variable
                              in my case

                              C:\Program Files (x86)\Windows Kits\10\bin\x86


                              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.

                              jsulmJ 1 Reply Last reply
                              0
                              • J.HilkJ J.Hilk

                                @jsulm Nope. you need to add the Windows(10) Kit binary folder to the Path variable
                                in my case

                                C:\Program Files (x86)\Windows Kits\10\bin\x86

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by
                                #14

                                @J.Hilk I'm not using Microsoft compiler, but can't you just add the absolute path to the debugger in QtCreator?

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

                                J.HilkJ 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @J.Hilk I'm not using Microsoft compiler, but can't you just add the absolute path to the debugger in QtCreator?

                                  J.HilkJ Offline
                                  J.HilkJ Offline
                                  J.Hilk
                                  Moderators
                                  wrote on last edited by
                                  #15

                                  @jsulm said in Trying to run default QT Plain C++ App -> -1073741515:

                                  @J.Hilk I'm not using Microsoft compiler, but can't you just add the absolute path to the debugger in QtCreator?

                                  If I'm not mistaken, than changing /adding stuff in your path variable via Qt-Creators project settings
                                  0_1506512981657_path.PNG

                                  is exactly that. My global System PATH variable is unchanged.


                                  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.

                                  1 Reply Last reply
                                  0
                                  • G ghost23

                                    Hi,

                                    well, as I said above, the ucrtbased.dll is not in my System32 folder, but in a subfolder in C:\Program Files(x86)\Windows Kits...

                                    I also tried disabling my anti-virus program, but it didn't make a difference.

                                    hskoglundH Online
                                    hskoglundH Online
                                    hskoglund
                                    wrote on last edited by
                                    #16

                                    @ghost23 Googled a bit, seems that ucrtbased.dll can indeed be missing from System32. In this thread the last post says the solution was to: "... uninstall and then install the Common Tools.."

                                    1 Reply Last reply
                                    0
                                    • G Offline
                                      G Offline
                                      ghost23
                                      wrote on last edited by ghost23
                                      #17

                                      Hi,

                                      oh so many replies :)

                                      So, yes I am using QTCreator. So, I have added the path to the x86 version of the ucrtbased.dll to the PATH variable in the System environment variables.

                                      A little bit has changed, when doing so. When I run the .exe manually in a CMD window, now I get the error "0xc000007b".

                                      IN QTCreator, though, I still get the same outcome, as before, although in the Project settings, I can see, that the Path to the ucrtbased.dll is also added.

                                      hskoglundH 1 Reply Last reply
                                      0
                                      • G ghost23

                                        Hi,

                                        oh so many replies :)

                                        So, yes I am using QTCreator. So, I have added the path to the x86 version of the ucrtbased.dll to the PATH variable in the System environment variables.

                                        A little bit has changed, when doing so. When I run the .exe manually in a CMD window, now I get the error "0xc000007b".

                                        IN QTCreator, though, I still get the same outcome, as before, although in the Project settings, I can see, that the Path to the ucrtbased.dll is also added.

                                        hskoglundH Online
                                        hskoglundH Online
                                        hskoglund
                                        wrote on last edited by
                                        #18

                                        @ghost23 Close, but no cigar. Error "0xc000007b" means that your 64-bit console program is trying to load the 32-bit version of ucrtbased.dll :-( You need to find a 64-bit flavor of ucrtbased.dll on your computer.

                                        1 Reply Last reply
                                        2
                                        • G Offline
                                          G Offline
                                          ghost23
                                          wrote on last edited by
                                          #19

                                          Hi,

                                          ok, so this took some time. Yesterday I found, that I had installed a mess of Microsoft and Windows SDKs and I thought, let's clean this up. So I uninstalled all those SDKs. Then I read the Qt documentation again and it says, that I should install a compiler as a requirement for Qt. One of the recommendations is to use Visual C++ build tools. So I have installed the Visual C++ Build Tools 2015.

                                          Then I start Qt, but I cannot compile my plain c++ app in Debug mode, because Qt cannot find a debugger. After some investigation, I find, that the Visual C++ build tools 2015 do not contain a debugger. Why isn't that mentioned in the documentation?

                                          So after somer further googling I find, that the Windows SDK comes with a debugger (the cdb.exe). So I install the Windows SDK. Now I have a debugger.

                                          Then, when I tried compile my app in debug mode, I got this error:

                                          LINK : fatal error LNK1158: cannot run 'rc.exe'
                                          

                                          So, for some reason, the place, where the rc.exe is, wasn't in my PATH. Added it, now finally, I can compile both the debug and the release version and run them without errors.

                                          Man, I have to say, I haven't even written one line of code as of now, but I am already exhausted.

                                          Thanks for all the help, though. Much appreciated.

                                          J.HilkJ jsulmJ 2 Replies Last reply
                                          0
                                          • G ghost23

                                            Hi,

                                            ok, so this took some time. Yesterday I found, that I had installed a mess of Microsoft and Windows SDKs and I thought, let's clean this up. So I uninstalled all those SDKs. Then I read the Qt documentation again and it says, that I should install a compiler as a requirement for Qt. One of the recommendations is to use Visual C++ build tools. So I have installed the Visual C++ Build Tools 2015.

                                            Then I start Qt, but I cannot compile my plain c++ app in Debug mode, because Qt cannot find a debugger. After some investigation, I find, that the Visual C++ build tools 2015 do not contain a debugger. Why isn't that mentioned in the documentation?

                                            So after somer further googling I find, that the Windows SDK comes with a debugger (the cdb.exe). So I install the Windows SDK. Now I have a debugger.

                                            Then, when I tried compile my app in debug mode, I got this error:

                                            LINK : fatal error LNK1158: cannot run 'rc.exe'
                                            

                                            So, for some reason, the place, where the rc.exe is, wasn't in my PATH. Added it, now finally, I can compile both the debug and the release version and run them without errors.

                                            Man, I have to say, I haven't even written one line of code as of now, but I am already exhausted.

                                            Thanks for all the help, though. Much appreciated.

                                            J.HilkJ Offline
                                            J.HilkJ Offline
                                            J.Hilk
                                            Moderators
                                            wrote on last edited by
                                            #20

                                            @ghost23 jup, run into exatcly the same issue.
                                            But the advantage of the MSVC compiler is, that it's about 5 times faster (on Windows) than mingw, so you'll have that time back in a couple of weeks :)

                                            You should set the topic to solved, if you managed to solve your problem :p


                                            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.

                                            1 Reply Last reply
                                            1

                                            • Login

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