Ogre3D shows segfault error

I'm writing a game using Ogre3D and I have a problem.

When I starting program, it shows an segfault error:

*-*-* 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]

And i don't know, why...

Code:

#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

(Code partly from Ogre Wiki)

resources.cfg :

# 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

and plugins.cfg :

# 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

And - when I comment Plugin=Plugin_CgProgramManager in plugins.cfg ... Program works, but I need this plugin. :)

Please help.
Thanks in advance.


  • Compile the program with debugging information included (with GCC, this means make sure the -g option is passed to the compiler).
  • Run it in a debugger.
  • When it crashes, you'll get a stack trace.
  • Investigate if it seems to depend on something you did (or not did, such as a missing initialization), or if it looks like a crash in Ogre3D proper.
  • If the former, fix it.
  • If the latter, report it.
  • 链接地址: http://www.djcxy.com/p/95540.html

    上一篇: 平台独立与C ++。 检测和编译

    下一篇: Ogre3D显示段错误