Integrating LUA (Assertion failed!)

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

User avatar
aaron1a12
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Sep 29, 2010 21:46
Location: Miami, Florida, USA

Integrating LUA (Assertion failed!)

Postby aaron1a12 » Wed Oct 13, 2010 01:05

Hi again guys, everything has been going great except when I integrate the LUA scripting module into CEGUI.

When I compile in VC2008 I get the following error:
Integrating LUA

1>Vita.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class CEGUI::LuaScriptModule & __cdecl CEGUI::LuaScriptModule::create(struct lua_State *)" (__imp_?create@LuaScriptModule@CEGUI@@SAAAV12@PAUlua_State@@@Z) referenced in function _WinMain@16
1>.\Vita-Debug.exe : fatal error LNK1120: 1 unresolved externals


Here are bits of my code:

Code: Select all

#include <iostream>
using namespace std;

//Load the engine
#include "engine.h"
//Load the scene processer
#include "ProcessScene.h"
//Load the UI engine
#include "include/CEGUI.h"
#include "include/RendererModules/OpenGL/CEGUIOpenGLRenderer.h"
//Load LUA For UI
#include "include/ScriptingModules/LuaScriptModule/CEGUILua.h"
//Load the input engine
#include "sdl/include/SDL.h"


and the lines that crash

Code: Select all

    // create a script module
    //THIS CRASHES
    CEGUI::LuaScriptModule& scriptmod(CEGUI::LuaScriptModule::create());

    // tell CEGUI to use this scripting module
    CEGUI::System::getSingleton().setScriptingModule(&scriptmod);


I reckon this is because the compiler is unable to locate a DLL? If so, which DLL am I supposed to get and where should I put it?
Last edited by aaron1a12 on Thu Oct 14, 2010 16:50, edited 1 time in total.
I hate BBCode pls enable <b>HTML</b> ;)

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

Re: Integrating LUA

Postby CrazyEddie » Wed Oct 13, 2010 09:19

It's a linker error, and you're missing a .lib file. In this case CEGUILuaScriptModule.lib (and CEGUILuaScriptModule_d.lib for debug builds).

HTH

CE.

User avatar
aaron1a12
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Sep 29, 2010 21:46
Location: Miami, Florida, USA

Re: Integrating LUA

Postby aaron1a12 » Thu Oct 14, 2010 15:20

Okay, thanks.
I hate BBCode pls enable <b>HTML</b> ;)

User avatar
aaron1a12
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Sep 29, 2010 21:46
Location: Miami, Florida, USA

Re: Integrating LUA

Postby aaron1a12 » Thu Oct 14, 2010 15:37

Okay, I managed to include the CEGUILuaScriptModule.lib and now my App includes CEGUILuaScriptModule.dll. BUT now I get an Assertion Failed message!

Assertion failed!
Program: C:\vita\Vita-Debug.exe
File: d:\projects\cegui\cegui_mk2-v0-7..\CEGUIS...leton.h
Line: 79

Expression: ms_Singleton


When I hit 'Retry' the app crashes. What am I doing wrong? And why does it make a reference to "d:\projects\cegui\"? My D: drive certainly does not contain the projects\cegui folder. Is this from when CEGUI was in development?

This my initialisation of CEGUI with Lua:

Code: Select all

    CEGUI::OpenGLRenderer &ceguiRenderer = CEGUI::OpenGLRenderer::create();

    // create a script module
    CEGUI::LuaScriptModule& scriptmod(CEGUI::LuaScriptModule::create());

    // tell CEGUI to use this scripting module
    //This Line Crashes Now
    CEGUI::System::getSingleton().setScriptingModule(&scriptmod);

    CEGUI::System::create(ceguiRenderer);
    ceguiRenderer.enableExtraStateSettings(true);
    CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
    rp->setResourceGroupDirectory("schemes", "GUI/schemes/");   
    rp->setResourceGroupDirectory("layouts", "GUI/layouts/");
    rp->setResourceGroupDirectory("looknfeel", "GUI/looknfeel/");
    rp->setResourceGroupDirectory("imagesets", "GUI/imagesets/");
    rp->setResourceGroupDirectory("fonts", "GUI/fonts/");
    CEGUI::Scheme::setDefaultResourceGroup("schemes");
    CEGUI::WindowManager::setDefaultResourceGroup("layouts");
    CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeel");
    CEGUI::Imageset::setDefaultResourceGroup("imagesets");
    CEGUI::Font::setDefaultResourceGroup("fonts");

    CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
    CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" );
    CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
    CEGUI::WindowManager &wm = CEGUI::WindowManager::getSingleton();
    CEGUI::Window *root = wm.loadWindowLayout("vita.layout");
    CEGUI::System::getSingleton().setGUISheet(root);

    //Set cursor
    CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
I hate BBCode pls enable <b>HTML</b> ;)

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Integrating LUA

Postby Kulik » Thu Oct 14, 2010 16:26

CEGUI::System wasn't created. Use bootstrap method of the OpenGLRenderer to create it for you...

User avatar
aaron1a12
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Sep 29, 2010 21:46
Location: Miami, Florida, USA

Re: Integrating LUA

Postby aaron1a12 » Thu Oct 14, 2010 16:46

What's the bootstrap method? Is what you talk about mentioned here?: http://cegui.org.uk/api_reference/rende ... orial.html

If so, I think it has nothing to do with my problem. My CEGUI renders and initialises perfectly well. It only gives me the assertion error when it gets to this line:

Code: Select all

CEGUI::System::getSingleton().setScriptingModule(&scriptmod);
I hate BBCode pls enable <b>HTML</b> ;)

User avatar
aaron1a12
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Wed Sep 29, 2010 21:46
Location: Miami, Florida, USA

Re: Integrating LUA (Assertion failed!)

Postby aaron1a12 » Thu Oct 14, 2010 16:52

SOLVED! I found out what was the problem! I was creating the scripting module BEFORE creating the renderer! Stupid! :rofl:
I hate BBCode pls enable <b>HTML</b> ;)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests