2

I am developing my QT application on windows 10 . The development is complete (as for now).

After run the application in debug mode from QT-creator, I am trying to run the executable from the build directory. But it shows me an "Application Error" dialog with the following message:

The application was unable to start correctly (0xc000a200). Click OK to close the application.

What is the problem and How to fix it ?!

McLan
  • 2,552
  • 9
  • 51
  • 85
  • *What is the problem* => No idea. *How to fix it* try to gather information in the Event Viewer – Thomas Ayoub Feb 08 '16 at 12:37
  • Most probably outside Qt Creator your app cannot find the Qt shared libraries (or maybe any other libraries your app uses, if any). Use [dependency walker](http://www.dependencywalker.com) to track down the libraries your executable depends on; if any are missing, locate them and add their paths to `PATH` environment variable – Dmitry Feb 08 '16 at 12:38
  • I'd recommend against adding Qt libs to your path, as this can cause problems. But having encountered this myself, I can assure you Dmitry is correct. Depending on the Qt functionality you used, add the appropriate Qt DLL files to your program's folder. – Christopher Schneider Feb 08 '16 at 13:29
  • Review this question for a couple solution http://stackoverflow.com/questions/22185974/deploying-qt-5-app-on-windows?rq=1 – Christopher Schneider Feb 08 '16 at 13:32
  • @Chris Are you *sure* this is the same problem? Yes, missing Qt DLLs will certainly cause an application to fail to start correctly, but this particular error message indicates the problem is related to app containers. It therefore seems unlikely that the problem is *missing* DLLs. The DLLs are there, they just have the wrong flags in their headers. – Cody Gray - on strike Feb 09 '16 at 05:46
  • @CodyGray Sure? No. That's why I didn't put it in an answer. Though after re-reading my comment, I said I was sure, didn't I? 99/100 times someone can't start a Qt app, it's because a library can't be found. Stop taking the words I wrote so literally :-) – Christopher Schneider Feb 10 '16 at 15:18

2 Answers2

7

The error codes are given to you in the error message for a reason. They don't mean anything to regular users, but we're programmers and we are the intended audience. Now that Google has been invented, you have absolutely no excuse for not taking the 5 seconds to Google the error code and see what it means.

In this case, 0xc000a200 is an error code that corresponds to STATUS_NOT_APPCONTAINER. The master list of COM error codes is in the Windows SDK headers, specifically ntstatus.h. If one looks this one up, one sees the following description:

This operation is only valid in the context of an app container.

Now, admittedly, once you get to this point, you may discover that you are in well over your head. You may not have any idea what an app container is, and certainly no clue about how to fix it. But at least then you would be able to ask a good question, which will go a long way to getting you a good answer.

But let's see if you can get lucky this time anyway. This error is most commonly encountered when an application that is not inside of an app container tries to load a DLL that is marked as being part of an app container. It is the linker that is responsible for marking a DLL as being or not being part of an app container, controlled by a series of options for whatever linker you're using. On Microsoft's linker, it is /APPCONTAINER:YES and /APPCONTAINER:NO that control this. I'm not sure what toolchain Qt Creator uses, but if it is not Microsoft's, this should at least get you started looking in the right place in that linker's documentation. Make sure that all DLLs used by your application are not being marked as part of an app container.

The option should be off by default for a regular C++ desktop application project, but it's possible that one of the DLLs started out life as part of a Windows Store app. Or it's possible that the switch just got thrown accidentally.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • First of all, I would like to show my appreciation for the thorough answer of yours. Secondly, you are totally right, I should have gone to google first which is what i did. But I am not a professional programmer and for me it is a hobby. I didn't understand a thing from the forums and I needed more plaintext explanation. I apologize. At least now, from your reply, I could look deep inside the problem and re-edit my question to be more precise and meaningful. – McLan Feb 08 '16 at 13:13
  • This works for me. I think this should be the accepted answer. @Suda.nese – Samer Dec 29 '16 at 22:58
1

I had the same error, but the approved solution wasn't the cure. What I found is that I had installed the wrong Qt compiler support packages. For me it was Qt 5.9.1 on Windows 10 64 bit to use with Visual Studio 2017. When installing Qt I selected the "msvc2017 64-bit" option. Sound good, right? Wrong: what I wanted was the "UWP x64 (MSVC2017)".

PfunnyGuy
  • 750
  • 9
  • 22