2011-02-01 13 views
2

私はOgre3Dを使用してゲームを書いていますが、問題があります。私はプログラムを開始するとOgre3Dはsegfaultエラーを表示します

、それがセグメンテーション違反のエラーを示しています。

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

を、私は知らない、なぜ...

コード:

#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

# 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

# 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.cfgPlugin=Plugin_CgProgramManagerコメント...プログラムは動作しますが、私はこのプラグインを必要とします。 :)

助けてください。
ありがとうございます。

+1

コードを表示しない限り、誰も助けることができません。 – Asha

+0

直接お手伝いすることはできませんが、gamedevコミュニティにhttp://gamedev.stackexchange.com/にお尋ねください。 – Exa

+0

Ogreforumもあります:Ogreのログファイルを見たいと思います。私はあなたもここにログファイルを投稿することができたと思います、あなたは最後のエントリが何であったのかを知るでしょう。 – Default

答えて

2
  1. デバッグ情報を含むプログラムをコンパイルします(GCCの場合は、-gオプションがコンパイラに渡されていることを確認してください)。
  2. デバッガで実行します。
  3. クラッシュするとスタックトレースが発生します。
  4. あなたがしたことに依存しているかどうか(初期化が欠落しているかどうかなど)、またはOgre3Dがクラッシュしているように見えるか調べます。
    1. 前者の場合は修正してください。
    2. 後者の場合は報告してください。
関連する問題