首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ogre3D显示段故障错误

Ogre3D显示段故障错误
EN

Stack Overflow用户
提问于 2011-02-01 16:02:09
回答 1查看 1.1K关注 0票数 2

我正在用Ogre3D写一个游戏,我有一个问题。

当我启动程序时,它显示segfault错误:

代码语言:javascript
复制
*-*-* OGRE Initialising                                                                                                                                                                                                                                                        
*-*-* Version 1.7.2 (Cthugha)                                                                                                                                                                                                                                                  
Creating resource group Essential                                                                                                                                                                                                                                              
Added resource location '../media/packs/SdkTrays.zip' of type 'Zip' to resource group 'Essential'
Added resource location '../media' of type 'FileSystem' to resource group 'General'
Added resource location '../media/materials/scripts' of type 'FileSystem' to resource group 'General'
Added resource location '../media/materials/textures' of type 'FileSystem' to resource group 'General'
Added resource location '../media/models' of type 'FileSystem' to resource group 'General'
Naruszenie ochrony pamięci [This means segfault]

我不知道为什么..。

代码:

代码语言:javascript
复制
#define OGRE_CHANGE1 ((1 << 16) | (1 << 8))

#include "Ogre.h"
#include "ExampleApplication.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#else
#include <iostream>
#endif

class MyApp : public ExampleApplication
{
  protected:
  public:
    MyApp()
    {
    }

    ~MyApp()
    {
    }
  protected:
    void createScene(void)
    {
    }
};

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
  MyApp App;
   try
   {
     App.go();
     return 0;
   }
   catch (Ogre::Exception& e)
   {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
     MessageBox( NULL, e.getFullDescription().c_str(), "Exception!",
           MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
     std::cerr <<"Exception:\n";
     std::cerr <<e.getFullDescription().c_str() <<"\n";
#endif
     return 1;
   }
}

#ifdef __cplusplus
}
#endif

(代码部分来自Ogre Wiki)

resources.cfg

代码语言:javascript
复制
# Resources required by the sample browser and most samples.
[Essential]
Zip=../media/packs/SdkTrays.zip

# Resource locations to be added to the default path
[General]
FileSystem=../media
FileSystem=../media/materials/scripts
FileSystem=../media/materials/textures
FileSystem=../media/models

plugins.cfg

代码语言:javascript
复制
# Defines plugins to load

# Define plugin folder
PluginFolder=/usr/lib/OGRE

# Define plugins
# Plugin=RenderSystem_Direct3D9
# Plugin=RenderSystem_Direct3D10
# Plugin=RenderSystem_Direct3D11
 Plugin=RenderSystem_GL
# Plugin=RenderSystem_GLES
 Plugin=Plugin_ParticleFX
 Plugin=Plugin_BSPSceneManager
 Plugin=Plugin_CgProgramManager
 Plugin=Plugin_PCZSceneManager
 Plugin=Plugin_OctreeZone
 Plugin=Plugin_OctreeSceneManager

当我在plugins.cfg里评论Plugin=Plugin_CgProgramManager的时候...程序可以工作,但我需要这个插件。:)

请帮帮忙。

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-01 17:11:53

  1. 使用包含的调试信息编译程序(对于GCC,这意味着确保将-g选项传递给编译器)。
  2. 在调试器中运行它。
  3. 当它崩溃时,如果它看起来依赖于您做过的(或没有做过的,例如缺少初始化),或者看起来像是Ogre3D中的崩溃,那么您将获得堆栈a。如果是前者,则报告
  4. 。如果是后者,则报告

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4860215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档