【问题标题】:Ogre3D shows exception when starting programOgre3D 启动程序时显示异常
【发布时间】:2011-01-29 10:36:01
【问题描述】:

我正在尝试使用 Ogre 引擎编写游戏。我遇到了很多问题 - GCC 没有编译程序,因为它没有找到 OgreMain_d 和 OIS_d...我创建了指向 libOgreMain.so.1.7.2 和 libOIS-1.3.0 的符号链接(我使用的是 Linux) .so 和 GCC 编译了我的程序,但是……程序显示错误:

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)

我的代码:

#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

请帮忙。

【问题讨论】:

  • 你的程序目录中是否有resources.cfg 文件? ExampleApplication 类(或 Ogre 本身)显然需要一个。

标签: c++ ogre3d


【解决方案1】:

您的提示清楚地显示在错误消息中。 Ogre 的示例框架期望某些文件可用,例如resource.cfg 甚至plugins.cfg。确保它在路径中,并且这些资源所需的媒体也可用。

【讨论】:

  • 好的,但是从哪里获得这些文件? :)
  • @m4tx,它们位于所有示例使用的 Ogre 发行版的媒体文件夹中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多