windows 应用程序未能正确初始化 (0xc0150002)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1231235/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:56:18  来源:igfitidea点击:

application failed to initialize properly (0xc0150002)

windowsvisual-studiovisual-c++visual-studio-2005

提问by Kazoom

my mfc application created in visual studio 5 running on windows server 2000 sp4, i create a release for it and try running it win xp slp2. it gives me application failed to initialize properly (0xc0150002)

我的 mfc 应用程序在 windows server 2000 sp4 上运行的 Visual Studio 5 中创建,我为它创建了一个版本并尝试运行它 win xp slp2。它让我应用程序无法正确初始化 (0xc0150002)

i have tried following things -Install Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) the one that comes within the release folder as well as one downloadable from website copied all dll and mainfest from microsoft visual sutdio\vc\redist

我尝试过以下操作 - 安装 Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) 发布文件夹中的一个以及可从网站下载的一个从 microsoft visual sutdio\vc\redist 复制了所有 dll 和 mainfest

I still keep receiving the same messsage. c

我仍然不断收到同样的消息。C

what could be wrong?how can i fix it

有什么问题?我该如何解决

回答by Andrey

some things to check:

要检查的一些事项:

  • check the /SUBSYSTEM linker option for you project. It might include OS major/minor version numbers.
  • ensure that you are using appropriate Windows XP PlatformSDK on DEV machine; check values of WINVER, _WIN32_WINNT
  • use dependsto see whether the problem is in unresolved dependencies
  • check the version of runtime that your application requires with that on target machine. I usually do this by looking at the app's manifest from one side and into WinSxS folder of the target machine from another (recently there had been an ATL Security update from Microsoft http://msdn.microsoft.com/en-us/visualc/ee309358.aspx; new binaries created by updated Visual Studio will not run on machines that haven't the same updated version of runtime).
  • 检查您项目的 /SUBSYSTEM 链接器选项。它可能包括操作系统主要/次要版本号。
  • 确保您在 DEV 机器上使用适当的 Windows XP PlatformSDK;检查 WINVER、_WIN32_WINNT 的值
  • 使用depends查看问题是否在未解决的依赖中
  • 检查您的应用程序所需的运行时版本与目标机器上的版本。我通常通过从一侧查看应用程序的清单并从另一侧查看目标计算机的 WinSxS 文件夹来执行此操作(最近有来自 Microsoft http://msdn.microsoft.com/en-us/visualc/的 ATL 安全更新ee309358.aspx;由更新的 Visual Studio 创建的新二进制文件将不会在没有相同更新版本的运行时的机器上运行)。

回答by Rolf Kristensen

It is possible you have applied a security update or compiler update to your VS2005 SP1. That makes it generate a manifest that requests a different MFC/CRT-dll than the one installed with Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) .

您可能已经对 VS2005 SP1 应用了安全更新或编译器更新。这使得它生成一个清单,该清单请求的 MFC/CRT-dll 与随 Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) 一起安装的 MFC/CRT-dll 不同。

Try to use Depends.exe and open your application, then in the menu choose "Profile". Look in the output window below for a more detailed description.

尝试使用 Depends.exe 并打开您的应用程序,然后在菜单中选择“配置文件”。在下面的输出窗口中查看更详细的描述。

回答by the_mandrill

Are you trying to run the debug version? That may give you an error similar to 0xc0150002. Try the release build, or you could compile against the static libraries rather than dynamic libraries. If you get this problem on a release build then the chances are that it's a missing dll (in which case try running Depends.exe) or an incorrect manifest.

您是否正在尝试运行调试版本?这可能会给您一个类似于 0xc0150002 的错误。尝试发布版本,或者您可以针对静态库而不是动态库进行编译。如果您在发布版本中遇到此问题,则可能是缺少 dll(在这种情况下尝试运行 Depends.exe)或不正确的清单。

If you have a missing dependency on a runtime dll you could try creating a deployment project for it as this will detect the appropriate runtime dlls and build it into an installer for you.

如果您缺少对运行时 dll 的依赖,您可以尝试为它创建一个部署项目,因为这将检测适当的运行时 dll 并将其构建到安装程序中。