2

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?

4

4 回答 4

3

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

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

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

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

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

于 2010-08-31T19:54:43.917 回答
3

对于它的价值,我遇到了同样的问题。在事件查看器中,我收到一条错误消息:

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

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

于 2011-12-29T19:12:44.170 回答
2

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

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

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

于 2013-09-30T16:41:31.570 回答
1

你和这个人有同样的问题吗?并行程序集、Windows 7 和 Visual Studio 2005

于 2010-08-31T18:27:28.743 回答