【问题标题】:C++ Ogre Runtime error 'Assertion failed'C++ Ogre 运行时错误“断言失败”
【发布时间】:2014-11-25 16:30:59
【问题描述】:

调试断言失败!

程序:...ments\Visual Studio 2013\Projects\OgreTest\Debug\OgreTest.exe
文件:f:\dd\vctools\crt\crtw32\misc\dbgheap.c
线路:1424

表达式:_pFirstBlock == pHead

有关您的程序如何导致断言的信息
失败, 请参阅有关断言的 Visual C++ 文档。

(按重试调试应用程序)

这就是我尝试执行我的 Ogre 应用程序时得到的结果。源代码是 Ogre 教程框架的完整副本。我从 Ogre.log 中发现了很多可笑的异常。似乎所有错误都来自OgreGpuProgramParams.cppOgreResourceGroupManager.cpp。接下来是一些第一批。我不能全部粘贴,因为大约有 1000 行这种废话。

17:55:32: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DualQuaternion.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: High-level program Ogre/DualQuaternionHardwareSkinningTwoWeightsCg encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DualQuaternion.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in DualQuaternion.program(14): setting of constant failed
17:55:32: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DualQuaternion.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: High-level program Ogre/DualQuaternionHardwareSkinningTwoWeightsTwoPhaseCg encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DualQuaternion.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in DualQuaternion.program(28): setting of constant failed
17:55:32: Parsing script Examples.program
17:55:32: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Example_Basic.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: High-level program Ogre/BasicVertexPrograms/AmbientOneTextureCg encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Example_Basic.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in Examples.program(16): setting of constant failed
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in Examples.program(17): setting of constant failed
17:55:32: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Example_Basic.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: High-level program Ogre/HardwareSkinningFourWeights encountered an error during loading and is thus not supported.
OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Example_Basic.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\..\..\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in Examples.program(314): setting of constant failed
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in Examples.program(315): setting of constant failed
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)
17:55:32: Compiler error: invalid parameters in Examples.program(316): setting of constant failed
17:55:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1709)

请注意,这些错误仅在使用 OpenGL 或 D3D9 渲染系统时出现。使用 D3D11 时,运行时错误不同:

OGRE EXCEPTION(3:RenderingAPIException):尝试渲染到 D3D11 没有顶点和片段着色器的设备没有固定的 d3d11 中的管道 - 使用 RTSS 或编写自定义着色器。在 D3D11RenderSystem::_render at ..........\RenderSystems\Direct3D11\src\OgreD3D11RenderSystem.cpp (第 2496 行)

如果有必要,我可以粘贴更多信息。有人知道解决办法吗?

【问题讨论】:

  • 在不知道导致问题的编码行的情况下,我们很难猜测。调试器告诉您有关崩溃的什么信息?你注意过食人魔的版本吗?
  • @PhilipAllgaier Crash 来自mRoot->startRendering()。我的 Ogre 版本是 1.9.0。
  • 我遇到了与上面相同的问题,但使用的是 VS 2015 :(

标签: c++ runtime-error assert ogre


【解决方案1】:

如果您混合发布版本和调试版本,通常会出现此错误。在 Ogre 的这种情况下,当您尝试使用调试构建 DLL 时,您的应用程序很可能是在发布模式下构建的。

您可以使用诸如Dependency Walker 之类的工具来检查在您的应用程序运行期间究竟加载了哪些 DLL。

另一个原因可能是您的 Ogre DLL 是由与实际应用程序不同的 IDE/编译器版本生成的。这通常会使它们二进制不兼容,从而导致崩溃。这可能是由于标准库的不同版本和相关的动态分配问题而发生的。如果您将 Ogre 库构建为“静态”,但使用动态依赖项(例如 OIS、插件等),这也是可能的。

关于日志中的错误:您似乎缺少一些导致这些日志条目的媒体文件(例如着色器)。

关于 D3D11:在该版本中,Microsoft 删除了 FFP(固定功能管道)。所以现在一切都是基于着色器的,这意味着你要么必须自己编写/提供这些,要么使用 Ogre 的集成着色器生成器 (RTTS)。

【讨论】:

  • 我用您推荐的工具检查了我的 exe,它说我的程序使用以下 dll:OgreMain_d.dll、OgreOverlay_d.dll、OIS_d.dll、user32.dll、MSVCP120D.dll、boost_system- vc120-mt-gd-1_55.dll、MSVCR120D.dll 和 kernel32.dll。所以它们都是调试 dll(不是吗?)。是的,我的程序是调试版本。
  • @user3725053 添加了有关编译器版本的注释。
猜你喜欢
  • 1970-01-01
  • 2022-08-23
  • 2015-06-27
  • 1970-01-01
  • 2016-02-21
  • 1970-01-01
  • 2020-06-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多