But CEGUI::LuaScriptModule:LuaScriptModule() is defined!

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

OffbeatPatriot
Just popping in
Just popping in
Posts: 8
Joined: Tue Jul 29, 2008 05:16

But CEGUI::LuaScriptModule:LuaScriptModule() is defined!

Postby OffbeatPatriot » Sun Sep 07, 2008 04:52

I'm kind of playing around with the demos in CEGUI, thing were going smooth until I tried to get into Lua. I keep getting this error.

Code: Select all

/tmp/ccuO9gq6.o: In function `main':
test.cpp:(.text+0xa74): undefined reference to `CEGUI::LuaScriptModule::LuaScriptModule()'
collect2: ld returned 1 exit status


when I run this code, this is just the main method and include stuff in my code.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
 
#include <SDL/SDL.h>

#include <CEGUILua.h>
 
#include <CEGUI.h>
#include <CEGUIDefaultResourceProvider.h>
#include <RendererModules/OpenGLGUIRenderer/openglrenderer.h>
 
#include <GL/gl.h>
#include <GL/glu.h>

using namespace CEGUI;

OpenGLRenderer *renderer;
LuaScriptModule* script_module;
Window* myRoot;

int main (int argc, char **argv)
{
   SDL_Surface * screen;
   atexit (SDL_Quit);
   SDL_Init (SDL_INIT_VIDEO);
   screen = SDL_SetVideoMode (600, 480, 0, SDL_OPENGL);
   if (screen == NULL) {
      fprintf (stderr, "Video Initialization Error: %s\n", SDL_GetError ());
      exit (1);
   }
   renderer = new OpenGLRenderer (0, 600, 480, 0);
   script_module = new LuaScriptModule();//PROBLEM SEEMS TO BE WITH THIS
   new CEGUI::System (renderer);
   CEGUI::System::getSingleton().setScriptingModule(script_module);

   CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>
     (CEGUI::System::getSingleton().getResourceProvider());

   rp->setResourceGroupDirectory("schemes", "./datafiles/schemes/");
   rp->setResourceGroupDirectory("imagesets", "./datafiles/imagesets/");
   rp->setResourceGroupDirectory("fonts", "./datafiles/fonts/");
   rp->setResourceGroupDirectory("layouts", "./datafiles/layouts/");
   rp->setResourceGroupDirectory("looknfeels", "./datafiles/looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", "./datafiles/lua_scripts/");
   
   Imageset::setDefaultResourceGroup("imagesets");
   Font::setDefaultResourceGroup("fonts");
   Scheme::setDefaultResourceGroup("schemes");
   WidgetLookManager::setDefaultResourceGroup("looknfeels");
   WindowManager::setDefaultResourceGroup("layouts");
   ScriptModule::setDefaultResourceGroup("lua_scripts");

   CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
   if(! CEGUI::FontManager::getSingleton().isFontPresent( "Commonwealth-10" ) )
     CEGUI::FontManager::getSingleton().createFont( "Commonwealth-10.font" );
   System::getSingleton().setDefaultMouseCursor( "TaharezLook", "MouseArrow" );
   System::getSingleton().setDefaultTooltip( "TaharezLook/Tooltip" );
   System::getSingleton().setDefaultMouseCursor( "TaharezLook", "MouseArrow" );

   myRoot = WindowManager::getSingleton().loadWindowLayout( "Demo8.layout" );
  System::getSingleton().setGUISheet( myRoot );


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


and I compile it in the terminal with this command:

Code: Select all

gcc test.cpp -I/usr/local/include/CEGUI/ -lSDL -lGL -lGLU -lCEGUIBase -lCEGUIOpenGLRenderer

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Sep 08, 2008 08:58

Hi,

When using the Lua module, you also need to link with its library (and maybe also the main lua lib(s) also).

IIRC the lua script module name is libCEGUILuaScriptModule.so, and as such a '-lCEGUILuaScriptModule' should get you going (as stated, you might also need -llua and maybe -llualib. Names may vary by system).

HTH

CE.

OffbeatPatriot
Just popping in
Just popping in
Posts: 8
Joined: Tue Jul 29, 2008 05:16

Postby OffbeatPatriot » Wed Sep 10, 2008 05:17

That worked, the program starts up now, thanks.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests