什么是 Windows 命令行 EXE 的“并行配置”?我该如何纠正它?

发布于 2024-09-16 22:21:43 字数 482 浏览 9 评论 0原文

我有一个用 C++ 编写的简单 .exe(使用 Visual Studio 2005 构建),它使用提供的 API 测试一些硬件。它在我构建它的 Windows 7 计算机上运行良好,但是当我将其复制到另一台 (Windows 7) 计算机并运行它(从命令行)时,我得到:

应用程序启动失败 因为它的并排配置 是不正确的。请参阅 应用程序事件日志或使用 命令行 sxstrace.exe 工具 更多细节。

什么是“并行配置”?

我运行 sxstrace.exe 并阅读使用信息。看来我需要检测我的 exe 来生成日志文件,以便 sxstrace.exe 有用吗?

我想问题是我的 exe 需要的 DLL 要么在其他机器上不存在,要么是错误的版本。如何找出我的 exe 使用哪些 DLL,以及它链接到我的计算机(运行的地方)上的哪些版本?关于将其复制到另一台计算机并使其运行还有其他建议吗?更多信息会有帮助吗?

I have a simple .exe written in C++ (built with Visual Studio 2005) that tests some hardware using a supplied API. It works fine on the Windows 7 machine I built it on, but when I copy it to another (Windows 7) machine and run it (from the command-line) I get:

The application has failed to start
because its side-by-side configuration
is incorrect. Please see the
application event log or use the
command-line sxstrace.exe tool for
more detail.

What is "side-by-side configuration"?

I ran sxstrace.exe and read the usage info. It appears I would need to instrument my exe to generate a log file for sxstrace.exe to be useful?

I imagine the problem is my exe requires DLLs that either don't exist on the other machine, or are the wrong version. How do I find out what DLLs my exe uses, and what versions it links to on my machine (where it works)? Any other advice on copying it to another machine and getting it running? Would more information help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

对你的占有欲 2024-09-23 22:21:43

mfawzymkh回答应用程序无法启动,因为并排配置不正确”问题(链接到在他对此问题的回答中链接到的问题spirulence)似乎也适用于这个问题。 mfawzymkh 写道:

您可以通过以下任一方式解决此问题
其中之一 1- 安装 VC8 调试 CRT
2- 将您的应用程序构建为静态链接

mfawzymkh 对同一答案的评论解释了如何构建为静态链接:

当你在 VS 中构建它时,转到
项目->设置->C/C++->代码
生成并选择Runtime Lib
选项为 /MTd 而不是 /MDd

我这样做了,并排配置消息消失了。 (在为我正在使用的 DLL 安装其他内容后,我的 EXE 就可以工作了。)

mfawzymkh's answer to the "application has failed to start because the side by side configauration is incorrect" question (linked to in the question spirulence linked to in his answer to this question) appears to apply to this question also. mfawzymkh writes:

You can resolve this issue by either
one of these 1- Install VC8 Debug CRT
2- Build you app as statically linked

And mfawzymkh's comment on that same answer explains how to build as statically linked:

when you build it in VS, go to
projects->settings->C/C++->Code
Generation and choose Runtime Lib
options to be /MTd instead of /MDd

I did that and the side-by-side configuration message is gone. (And after installing something else for the DLL I was using, my EXE works.)

橙味迷妹 2024-09-23 22:21:43

无论如何,我遇到了同样的问题。在事件查看器中,我收到一条错误消息:

“C:\\MyExe.exe”的激活上下文生成失败。清单或策略文件“C:\\MyExe.exe.Config”第 12 行出现错误。无效的 Xml句法。

果然,我更改了连接字符串并省略了结束引号。添加回来并解决了问题。

For what it's worth, I encountered the same issue. In the Event Viewer I had an error message that read:

Activation context generation failed for "C:\\MyExe.exe".Error in manifest or policy file "C:\\MyExe.exe.Config" on line 12. Invalid Xml syntax.

Sure enough, I'd changed a connection string and left out the closing quote. Added that back in and it solved the issue.

白鸥掠海 2024-09-23 22:21:43

“当你在 VS 中构建它时,转到项目 -> 设置 -> C/C++ -> 代码生成并选择运行时库选项为 /MTd 而不是 /MDd”对我有用,尽管我对发布版本而不是调试版本。

微软 说:
/MT 使您的应用程序使用运行时库的多线程静态版本。定义 _MT 并导致编译器将库名称 LIBCMT.lib 放入 .obj 文件中,以便链接器将使用 LIBCMT.lib 来解析外部符号。

/MD
使您的应用程序使用运行时库的多线程和 DLL 特定版本。定义 _MT 和 _DLL 并使编译器将库名称 MSVCRT.lib 放入 .obj 文件中。
使用此选项编译的应用程序静态链接到 MSVCRT.lib。该库提供了一层代码,允许链接器解析外部引用。实际工作代码包含在 MSVCR100.DLL 中,与 MSVCRT.lib 链接的应用程序必须在运行时可用。

"when you build it in VS, go to projects->settings->C/C++->Code Generation and choose Runtime Lib options to be /MTd instead of /MDd" worked for me, although I was interested in the Release version instead of the Debug version.

Microsofto says:
/MT Causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.

/MD
Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.
Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR100.DLL, which must be available at run time to applications linked with MSVCRT.lib.

素手挽清风 2024-09-23 22:21:43

你是否也和这位朋友面临着同样的问题呢? 并排程序集、Windows 7 和 Visual工作室2005

Are you suffering from the same issue as this guy? Side-by-side assemblies, Windows 7, and Visual Studio 2005

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文