Page 1 of 1

Failed to load module exception. <-- fixed

Posted: Mon Feb 13, 2006 00:46
by Iftah
edit:
gag, Im such a noob, I didn't realize there are DLLs for the schemes as well, I copied them and its all fixed now.


hi

Im trying to add GUI to my game and CEGUI seemed like the perfect choice.
But I cant get it to work, not even the example code.

Im using SDL with OpenGL.

I get an exception at line that loads the scheme (number 39 of the main func,
CEGUI::SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");
)

the exception text is:
FactoryModule::FactoryModule - Failed to load module 'CEGUITaharezLook_d'.

does anyone know why the exception occurs?
or how can I fix it?
please?!


I thought maybe it fails to find the file, so I tried changing all the relative file location to absolute locations (in my code) but it didnt change.

as you can see below, my entire code is copy-pasted from the different tutorials, so I dont think the code is to blame.
I am using .NET 2003 (7.1)
To get it to compile and link I had to:
1) set include/lib dirs for SDL and CEGUI
2) change the code generation MultiThreaded Debug DLL
3) add "SDL.lib SDLmain.lib OpenGLGUIRenderer_d.lib CEGUIBase_d.lib opengl32.lib GLu32.lib GLaux.lib /NODEFAULTLIB:msvcrt.lib" to the linker command line options.
4) copy the SDL.dll and two CEGUI dlls (base and renderer) to the Debug dir.

so, I got it to build but I cant get around that exception.

Code: Select all

int main(int argc, char* argv[])
{
   if (SDL_Init(SDL_INIT_VIDEO)<0)
   {
      fprintf(stderr, "Unable to initialise SDL: %s", SDL_GetError());
      exit(0);
   }

   if (SDL_SetVideoMode(800,600,0,SDL_OPENGL)==NULL)
   {
      fprintf(stderr, "Unable to set OpenGL videomode: %s", SDL_GetError());
      SDL_Quit();
      exit(0);
   }

   glEnable(GL_CULL_FACE);
   glDisable(GL_FOG);
   glClearColor(0.0f,0.0f,0.0f,1.0f);
   glViewport(0,0, 800,600);

   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   gluPerspective(45.0, 800.0/600.0, 0.1,100.0);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();

   try
   {

      CEGUI::OpenGLRenderer* renderer = new CEGUI::OpenGLRenderer(0,800,600);
      new CEGUI::System(renderer);


      SDL_ShowCursor(SDL_DISABLE);
      SDL_EnableUNICODE(1);
      SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);


      // load in the scheme file, which auto-loads the TaharezLook imageset

/******  THIS IS THE EXCEPTION THROWING LINE *******/       CEGUI::SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLook.scheme");

      // load in a font.  The first font loaded automatically becomes the default font.
      CEGUI::FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");

      CEGUI::System::getSingleton().setDefaultFont("Commonwealth-10");
      CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

      CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
      CEGUI::Window* myRoot = wmgr.createWindow("DefaultWindow", "root");
      CEGUI::System::getSingleton().setGUISheet(myRoot);

      CEGUI::FrameWindow* fWnd = (CEGUI::FrameWindow*)wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");
      myRoot->addChildWindow(fWnd);
      fWnd->setPosition( CEGUI::Point( 0.25f, 0.25f ) );
      fWnd->setSize( CEGUI::Size( 0.5f, 0.5f ) );
      fWnd->setText( "Hello World!" );
   }
   catch (CEGUI::Exception& e)
   {
      fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
      printf("quiting...\n");
      exit(1);
      // you could quit here
   }


   bool must_quit = false;
 
   // get "run-time" in seconds
   double last_time_pulse = 0.001*static_cast<double>(SDL_GetTicks());
    
   while (!must_quit)
   {
      inject_input(must_quit);
      inject_time_pulse(last_time_pulse);
      render_gui();
   }
   return 0;
}



thanks,
Iftah.