C ++ Ogre运行时错误'断言失败'

时间:2014-11-25 16:30:59

标签: c++ runtime-error assert ogre

  

Debug Assertion失败!

     

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

     

表达式:_pFirstBlock == pHead

     

有关程序如何引起断言的信息   失败,   请参阅关于断言的Visual C ++文档。

     

(按“重试”调试应用程序)

这是我尝试执行我的Ogre应用程序时得到的结果。 Source是Ogre Tutorial Framework的完整副本。我从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 :: _渲染于   .......... \ RenderSystems \ Direct3D11的\ src \ OgreD3D11RenderSystem.cpp   (第2496行)

我可以粘贴更多信息,这是必要的。有人知道解决方案吗?

1 个答案:

答案 0 :(得分:0)

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

您可以使用Dependency Walker之类的工具来检查在应用程序运行期间确切加载的DLL。

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

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

关于D3D11:在该版本中,Microsoft删除了FFP(固定功能管道)。因此,现在所有内容都以着色为基础,这意味着您必须自己编写/提供这些内容或使用Ogre的集成着色器生成器(RTTS)。