如果在 WinXP 上的调试版本中使用 boost (C++) 库,则无法执行程序

发布于 2024-07-11 09:00:22 字数 1465 浏览 10 评论 0原文

我在几个 C++ 项目中使用 boost。 我最近进行了升级(1.33.1 到 1.36,很快到 1.37),从那时起我无法再运行任何调试版本。

为了确保不存在其他项目问题,我创建了一个最小测试项目,其中仅包含 boost.thread,并使用它来启动一种方法。 尽管 Dependency Walker 显示已找到所有必需的库(这也意味着在 SxS 目录中找到了所需的 MS Debug CRT),但可以启动发布版本,而不能启动调试版本。

启动时我只得到:

Die Anwendung konnte nicht richtiginitialisiert werden (0xc0150002)。 单击“OK”,um die Anwendung zu bedenden。

这意味着“无法初始化应用程序”。 互联网研究主要导致MS Office安装问题,建议对WinXP进行修复。

那么,除了修复设置(我认为这不会有帮助,因为我正在谈论 debug-dll 问题),还有什么想法吗?

啊,在我忘记之前:绝对相同的源代码不会导致构建机器上出现错误(即,DLL 可以注册,意味着执行)。 所以这显然是一个安装问题,但是由于 DLL 在那里,并且 dependency-walker 找到了它,我还忘记了什么?

编辑)好吧,我还没有解决我的问题,但感谢 deemok 我又向前迈进了一步。 为了减少误解,我在下面进行一些澄清:

  • 程序无法在开发人员机器上运行,
  • 我正在使用安装的 VS2005(它是 VC++8)项目)
  • 我使用了 BoostPro 中的 boost-setup,编译了所有可能的构建版本,并且我仔细检查它们是否存在(否则我在构建过程中已经收到链接器错误)。
  • 我仔细检查了我能想到的 include/lib/bin 配置的任何角落——因为 boost 在 Windows 上使用自动链接,并且具有特殊的命名约定,因此构建或启动会失败,但更容易理解错误信息。
  • 不能使用静态链接,因为boost.thread需要DLL项目的动态链接(我也许可以在这里搞乱,但由于这个问题似乎只发生在我的机器上,我不想搞乱这一点,因为我确信 boost 人员一开始就有理由将检查放在那里)
  • 正如我所写的,我与 Dependency Walker 进行了检查,它说一切都很好。

目前似乎是 boost-dll 中的错误(可能是不正确的清单),将进行检查。

I'm using boost for several C++ projects. I recently made a upgrade (1.33.1 to 1.36, soon to 1.37), since then I cannot run any debug-builds anymore.

To be sure that no other project issues remain, I've created a minimum test-project, which only includes boost.thread, and uses it to start one method. The release build can be started, the debug build cannot, although the Dependency Walker shows that all required libraries are found (this also means that the required MS Debug CRT is found in the SxS directory).

On startup I only get:

Die Anwendung konnte nicht richtig initialisiert werden (0xc0150002).
Klicken Sie auf "OK", um die Anwendung zu beenden.

Which means nothing more than "failed to initialize app". An internet research primarily lead to an MS Office installation problem, which recommends to perform a repair of WinXP.

So, beside the repair setup (which I think will not help as I'm talking about debug-dll issues), any ideas?

Ah, before I forget: Absolutely the same source-code leads to no errors on the build-machine (i.e., DLLs can be registered, means executed). So it's obviously an installation problem, but as the DLLs are there, and dependency-walker finds it, what else have I forgotten?

(edit) Well, I have not yet resolved my problem, but thanks to deemok I'm a step further. For the sake of reducing misunderstandings I give some clarifications below:

  • The program fails to run on the developer-machine
  • I am working with an installed VS2005 (it's a VC++8 project)
  • I used the boost-setup from BoostPro, compiled all possible build-versions, and I double-checked that they are there (otherwise I'd already get linker-errors during build).
  • and I double-checked any corner of include/lib/bin configuration I can think of -- as boost uses auto-linking on windows, with a special naming convention, the build or start-up would have failed, with a much more comprehensible error-message.
  • I cannot use static linking, as boost.thread requires dynamic linking for DLL projects (I maybe could mess around here, but as this problem seems to happen only on my machine, I do not want to mess with this, as I'm sure the boost-guys had a reason to place that check in there in the first place)
  • As I wrote, I checked with Dependency Walker, and it says everything is just fine.

Currently it seems to be an error in the boost-dll (maybe incorrect Manifest), will check that.

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

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

发布评论

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

评论(4

飞烟轻若梦 2024-07-18 09:00:22

这是一个 并排 (SxS) 问题 – 仅仅复制 DLL 已经不够了。

关于调试版本的具体问题,请参阅:运行 vc2008 调试版本非开发机器

简短回答:

你不能,因为调试运行时没有安装程序 redist(事实上,软件许可证禁止分发它,所以即使你确实得到了一些东西,你也会违反 EULA)。

因此,您需要在那里安装 Visual Studio。

但是,如果您仍然想尝试不走这条路,您可以阅读 puetzk 的完整回答

或者,您可以尝试静态链接所有内容

It's a Side-by-Side (SxS) issue – simply copying the DLLs is not enough anymore.

Regarding your specific problem concerning the Debug build, see: Running vc2008 debug builds on non-dev machines

Short answer:

You can't, because there's no installer redist for the debug runtime (and in fact the software license forbids distributing it, so you'd be breaking the EULA even if you did get something put together).

So, you'll need to install Visual Studio there.

However, if you still want to try without taking that path, you could read puetzk's answer in its entirety.

Or, you could try to link everything statically.

下壹個目標 2024-07-18 09:00:22

那么您正在使用 BoostPro 中的预构建库? 如果是这样,您的环境可能与它们内置的环境略有不同(是否为 TR1 功能包等)。 也许最好尝试 在您的特定环境中构建自我提升

So you are using the pre-built libraries from BoostPro? If so, your environment might somehow be slightly different to the one they were built in (TR1 feature pack or not, etc). Perhaps best to try building Boost yourself in your specific environment.

意中人 2024-07-18 09:00:22

这可能与 SxS 无关。 我建议检查事件日志中的 SxS 错误消息,并使用依赖项遍历器检查最可能的 DLL 依赖项问题,或者其中一个 DLL 从其 DllMain 返回 FALSE(无论出于何种原因)。

另外,启用加载器快照:

gflags -i yourapp.exe +sls

在调试器(或就此而言的依赖项步行器)下运行时可能会带来额外的启发。

注意:gflags 是 Windows 调试工具的一部分。

This might turn out to have nothing to do with SxS. I suggest checking the Event Log for SxS error messages and using dependency walker to check for most probable DLL dependency issue, or one of the DLLs is returning FALSE from its DllMain (for whatever reason).

Also, enabling loader snaps:

gflags -i yourapp.exe +sls

might shed extra light when run under debugger (or dependency walker for that matter).

Note: gflags is part of Windows debugging tools.

悲念泪 2024-07-18 09:00:22

为自己获取dependency walker。 在其中打开您的应用程序 exe。 它将显示您的应用程序需要但无法加载/访问的所有 dll。

如果这还不够,您还可以使用依赖项遍历器分析您的应用程序,这将为您提供大量输出以找出问题所在。

[编辑]
因为您只在调试构建时遇到问题:
确保升级 boost 时,不仅重建了 boost 的发布二进制文件,还重建了调试二进制文件。 当然,请确保调试版本是使用与您现在使用的相同版本的 VisualStudio 构建的。

并确保包含路径(工具 -> 选项 -> 项目和解决方案 -> VC++ 目录)正确:最新 boost 版本的路径必须存在,而不是旧版本的路径。

Get yourself the dependency walker. Open your application exe in it. It will show you all the dlls that your application needs but can't load/access.

If that's not enough, you can also profile your app with the dependency walker, which will give you a lot of output to find out where the problem is.

[edit]
since you only have problems with the debug build:
make sure that when you upgraded boost, you also rebuilt not just the release binaries but also the debug binaries of boost. And of course, make sure that the debug build was built with the same version of VisualStudio than you're using now.

And make sure that the include paths (tools->options->projects and solutions->VC++ directories) are correct: the paths to the latest boost version must be there, not maybe to an older version.

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