在Win10上使用VS2015编译的C ++ SDL2程序中调试加载时间错误 [英] Debugging load time error in C++ SDL2 program compiled with VS2015 on Win10

查看:169
本文介绍了在Win10上使用VS2015编译的C ++ SDL2程序中调试加载时间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2015在64位Windows 10上用C ++和SDL2编写一个项目。我最近购买了一台新的Windows 10笔记本电脑,并从github中克隆了我的项目。我的项目正确编译,但是运行它时出现以下错误:


应用程序无法正确启动(0xc000007b)。


根据我到目前为止的研究,此错误通常是由加载不兼容的DLL引起的,例如64位版本而不是32位版本。到目前为止,我发现的建议包括:




  • 检查我使用的是SDL2 DLL的32位版本

  • 为Visual Studio 2015安装/重新安装Visual C ++ Redistributable的x86版本

  • 使用



    Dependency Walker分析结果



    在那之后,探查器将冻结并且永远不会继续。请注意,SDL组件和VC运行时正在正确加载。



    该程序可以在我的两台旧计算机上正确编译并加载,其中一台运行32位Windows 7,另一台运行Windows 7。运行64位Windows 10。



    现在是实际问题了。我可以采取哪些其他步骤来调试此崩溃?还是有人从我提供的我做错的信息中看到了?



    相关问题:






    • 在这一点上,像以前一样,Dependency Walker冻结。我仍然完全迷失了自己,似乎无法确定导致问题的原因。

      解决方案

      <我感到非常愚蠢,但是我终于找到了真正的问题。我正在使用SDL字体库SDL2_ttf,而我只是没有将zlib.dll从SDL2_ttf lib目录复制到构建目录中。我不明白为什么错误消息如此神秘;过去缺少的DLL给了我一个有用的 foo.dll丢失错误消息。



      无论如何,谢谢大家的帮助。至少我学到了一个有用的教训:在怀疑更复杂的问题之前,请务必确保所有必需的DLL都存在。


      I'm writing a project in C++ with SDL2 on 64-bit Windows 10 using Visual Studio 2015. I recently purchased a new Windows 10 laptop and cloned my project from github. My project compiles correctly, but I get the following error when I run it:

      The application was unable to start correctly (0xc000007b). Click OK to close the application.

      Based on my research so far, this error is usually caused by loading an incompatible DLL, e.g. a 64-bit version instead of 32-bit. Suggestions I've found so far include:

      • Checking that I'm using the 32-bit versions of the SDL2 DLLs
      • Installing/reinstalling the x86 version of the Visual C++ Redistributable for Visual Studio 2015
      • Using Dependency Walker to troubleshoot which DLL is failing

      My project is set to build for Win32, and I've ensured that I'm using the 32-bit versions of all DLLs I'm explicitly linking (libfreetype-6, libpng16-16, SDL2, SDL2_image, SDL2_mixer, and SDL2_ttf). I have confirmed that the x86 VC++ Redistributable is installed on my machine.

      Finally, I've attempted to use Dependency Walker to determine what DLL might be causing the problem (although I've read caveats that Dependency Walker has a lot of false positives). These were the results:

      Dependency Walker static analysis

      Dependency Walker profiling results

      After that point, the profiler freezes and never continues. Note that the SDL components and the VC runtime are loading without error.

      The program compiles and loads correctly on my two older machines, one running 32-bit Windows 7 and one running 64-bit Windows 10.

      Now for the actual question. What other steps can I take to debug this crash? Or does anyone see from the information I've provided what I'm doing wrong?

      Related questions:

      Edit:

      As rflobao suggested, I was using the 64-bit version of Dependency Walker on a 32-bit exe. Here is the new output of my profiling run:

      At this point, as before, Dependency Walker freezes. I'm still totally lost and don't feel like I'm any closer to being able to determine what's causing the problem.

      解决方案

      I feel profoundly dumb, but I finally figured out the real problem. I'm using the SDL font library SDL2_ttf, and I simply hadn't copied zlib.dll from the SDL2_ttf lib directory into my build directory. I don't understand why the error message was so cryptic; in the past missing DLLs have given me a helpful "foo.dll is missing" error message.

      Anyway, thank you all for your help. At least I've learned a useful lesson: always make sure all the required DLLs are present before suspecting a more complex problem.

      这篇关于在Win10上使用VS2015编译的C ++ SDL2程序中调试加载时间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆