The application was unable to start correctly (0xc000007b)

前端 未结 17 1316
無奈伤痛
無奈伤痛 2020-11-22 13:12

I have a client/server app which I have been developing on a single PC. Now it needs two serial ports, so I borrowed a PC from a friend.

When I build my app and try

相关标签:
17条回答
  • 2020-11-22 13:37

    It is a missing dll. Possibly, your dll that works with com ports have an unresolved dll dependence. You can use dependency walker and windows debugger. Check all of the mfc library, for example. Also, you can use nrCommlib - it is great components to work with com ports.

    0 讨论(0)
  • 2020-11-22 13:38

    I tried all the things specified here and found yet another answer. I had to compile my application with 32-bit DLLs. I had built the libraries both in 32-bit and 64-bit but had my PATH set to 64-bit libraries. After I recompiled my application (with a number of changes in my code as well) I got this dreaded error and struggled for two days. Finally, after trying a number of other things, I changed my PATH to have the 32-bit DLLs before the 64-bit DLLs (they have the same names). And it worked. I am just adding it here for completeness.

    0 讨论(0)
  • 2020-11-22 13:40

    You can have this if you are trying to manifest your application that it has a dependancy on the Microsoft.Windows.Common-Controls assembly. You do this when you want to load Version 6 of the common controls library - so that visual styles are applied to common controls.

    You probably followed Microsoft's original documentation way back from Windows XP days, and added the following to your application's manifest:

    <!-- Dependancy on Common Controls version 6 -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                    type="win32"
                    name="Microsoft.Windows.Common-Controls"
                    version="6.0.0.0"
                    processorArchitecture="X86"
                    publicKeyToken="6595b64144ccf1df"
                    language="*"/>
        </dependentAssembly>
    </dependency>
    

    Windows XP is no longer the OS, and you're no longer a 32-bit application. In the intervening 17 years Microsoft updated their documentation; now it's time for you to update your manifest:

    <!-- Dependancy on Common Controls version 6 -->
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                    type="win32"
                    name="Microsoft.Windows.Common-Controls"
                    version="6.0.0.0"
                    processorArchitecture="*"
                    publicKeyToken="6595b64144ccf1df"
                    language="*"/>
        </dependentAssembly>
    </dependency>
    

    Raymond Chen has a lovely history of the Common Controls:

    • The history of the Windows XP common controls (archive)
    0 讨论(0)
  • 2020-11-22 13:41

    I recently had an issue where I was developing an application (that used a serial port) and it worked on all the machines I tested it on but a few people were getting this error.

    It turns out all the machines that the error happened on were running Win7 x64 and had NEVER ONCE been updated.

    Running a Windows update fixed all of the machines in my particular case.

    0 讨论(0)
  • 2020-11-22 13:41

    I experienced the same problem developing a client-server app using Microsoft Visual Studio 2012.

    If you used Visual Studio to develop the app, you must make sure the new (i.e. the computer that the software was not developed on) has the appropriate Microsoft Visual C++ Redistributable Package. By appropriate, you need the right year and bit version (i.e. x86 for 32 bit and x64 for 64 bit) of the Visual C++ Redistributable Package.

    The Visual C++ Redistributable Packages install run-time components that are required to run C++ applications built using Visual Studio.

    Here is a link to the Visual C++ Redistributable for Visual Studio 2015 .

    You can check what versions are installed by going to Control Panel -> Programs -> Programs and Features.

    Here's how I got this error and fixed it:

    1) I developed a 32 bit application using Visual Studio 2012 on my computer. Let's call my computer ComputerA.

    2) I installed the .exe and the related files on a different computer we'll call ComputerB.

    3) On ComputerB, I ran the .exe and got the error message.

    4) On ComputerB, I looked at the Programs and Features and didn't see Visual C++ 2012 Redistributable (x64).

    5) On ComputerB, I googled for Visual C++ 2012 Redistributable and selected and installed the x64 version.

    6) On ComputerB, I ran the .exe on ComputerB and did not receive the error message.

    0 讨论(0)
  • 2020-11-22 13:41

    That can happen if for some reason a x86 resource is loaded from a x64 machine. To avoid that explicitly, add this preprocessor directive to stdafx.h (of course, in my example the problematic resource is Windows Common Controls DLL.

    #if defined(_WIN64)
    #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df'\"")
    #endif
    
    0 讨论(0)
提交回复
热议问题