简体   繁体   English

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

[英]Cannot execute program if using boost (C++) libraries in debug-version on WinXP

I'm using boost for several C++ projects. 我正在将Boost用于多个C ++项目。 I recently made a upgrade (1.33.1 to 1.36, soon to 1.37), since then I cannot run any debug-builds anymore. 我最近进行了升级(从1.33.1升级到1.36,不久又升级到1.37),因为那时我再也无法运行任何调试版本了。

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

On startup I only get: 在启动时,我只会得到:

Die Anwendung konnte nicht richtig initialisiert werden (0xc0150002). Die Anwendung konnte nicht richtig initialisiert werden(0xc0150002)。 Klicken Sie auf "OK", um die Anwendung zu beenden. Klicken Sie auf“ OK”,我死了。

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. 互联网研究主要导致MS Office安装问题 ,建议执行WinXP修复。

So, beside the repair setup (which I think will not help as I'm talking about debug-dll issues), any ideas? 因此,除了修复设置(我认为这对我讨论debug-dll问题没有帮助)之外,还有什么想法吗?

Ah, before I forget: Absolutely the same source-code leads to no errors on the build-machine (ie, DLLs can be registered, means executed). 啊,在我忘记之前:完全相同的源代码不会在构建计算机上导致任何错误(即,可以注册DLL,意味着可以执行)。 So it's obviously an installation problem, but as the DLLs are there, and dependency-walker finds it, what else have I forgotten? 所以这是很明显的安装问题,但由于DLL文件都在那里,而且依赖学步车找到它,还有什么我已忘记了吗?

( edit ) Well, I have not yet resolved my problem, but thanks to deemok I'm a step further. 编辑 )好吧,我还没有解决我的问题,但是多亏了deemok,我才迈出了一步。 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) 我正在使用已安装的 VS2005(这是VC ++ 8项目)
  • 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). 我使用了BoostPro的boost-setup,编译了所有可能的构建版本,然后再次检查了它们是否存在(否则我在构建过程中会出现链接器错误)。
  • 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. 并且我仔细检查了我能想到的include / lib / bin配置的任何角落-由于boost使用Windows上的自动链接,并具有特殊的命名约定,因此构建或启动会失败,并且更容易理解错误信息。
  • 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) 不能使用静态链接 ,因为boost.thread需要DLL项目的动态链接(我可能会在这里乱七八糟,但由于此问题似乎仅在我的机器上发生,我不希望对此感到困惑,因为我敢肯定助教人有理由将检查放在第一位)
  • As I wrote, I checked with Dependency Walker, and it says everything is just fine. 如我所写,我与Dependency Walker进行了核对,结果说一切都很好。

Currently it seems to be an error in the boost-dll (maybe incorrect Manifest), will check that. 目前,在boost-dll中似乎是一个错误(也许是不正确的Manifest),将检查该错误。

It's a Side-by-Side (SxS) issue – simply copying the DLLs is not enough anymore. 这是一个并发 (SxS)问题-仅复制DLL就是不够的。

Regarding your specific problem concerning the Debug build, see: Running vc2008 debug builds on non-dev machines 关于与Debug构建有关的特定问题,请参阅: 在非dev计算机上运行vc2008调试构建

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). 您不能这样做,因为没有用于调试运行时的安装程序重新编写器(实际上,软件许可证禁止分发它,因此即使您确实将某些内容放在一起,也可能违反EULA)。

So, you'll need to install Visual Studio there. 因此,您需要在此处安装Visual Studio。

However, if you still want to try without taking that path, you could read puetzk's answer in its entirety. 但是,如果您仍然想尝试不走那条路,则可以完整阅读puetzk的答案

Or, you could try to link everything statically . 或者,您可以尝试静态链接所有内容

This might turn out to have nothing to do with SxS. 事实证明,这可能与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). 我建议检查事件日志中是否存在SxS错误消息,并使用依赖关系遍历检查最可能的DLL依赖关系问题,或者其中一个DLL从其DllMain返回FALSE(出于某种原因)。

Also, enabling loader snaps: 另外,启用加载程序捕捉:

gflags -i yourapp.exe +sls 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 . 注意:gflags是Windows调试工具的一部分。

So you are using the pre-built libraries from BoostPro? 因此,您正在使用BoostPro的预构建库吗? If so, your environment might somehow be slightly different to the one they were built in (TR1 feature pack or not, etc). 如果是这样,您的环境可能与内置环境有所不同(是否有TR1功能包,等等)。 Perhaps best to try building Boost yourself in your specific environment. 也许最好尝试在您的特定环境中增强自己

Get yourself the dependency walker . 让自己成为依赖者 Open your application exe in it. 在其中打开您的应用程序exe。 It will show you all the dlls that your application needs but can't load/access. 它会向您显示您的应用程序需要但无法加载/访问的所有dll。

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. [edit]因为您仅在调试版本上遇到问题:请确保在升级boost时,不仅要重新构建boost的发行版二进制文件,还要重新构建debug二进制文件。 And of course, make sure that the debug build was built with the same version of VisualStudio than you're using now. 当然,请确保使用与您现在使用的版本相同的VisualStudio构建调试版本。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM