Search code examples
c++ogre3d

Ogre3D shows exception when starting program


I'm trying to write game using Ogre engine. I had a lot of problems - GCC didn't compiled program because it didn't found OgreMain_d and OIS_d... I created symbolic links (I'm using Linux) to libOgreMain.so.1.7.2 and libOIS-1.3.0.so and GCC compiled my program, but... the program shows error:

OGRE EXCEPTION(6:FileNotFoundException): 'resources.cfg' file not found! in ConfigFile::load at /home/m4tx/Programs/ogre_src_v1-7-2/OgreMain/src/OgreConfigFile.cpp (line 83)

My 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

// Dziedziczymy ExampleApplication
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

Please help.


Solution

  • Your hint is clearly in the error message. The example framework for Ogre expects certain files to be available, such as resource.cfg and even plugins.cfg. Make sure this is in the path, and that the media required by those resources is also available.