I use ogre+CEGUI+luaplus,I want to call subscribeEvent() in my class CGameUIScript,so When click a CEGUI button I can run a luaplus script to do something,
Ogre version is 1.7.1,CEGUI version is 0.7.1,my CGameUIScript as follow:
Code: Select all
//--------------------------------------------------------
#include <CEGUIScriptModule.h>
#include <ceguievent.h>
#include <CEGUIEventSet.h>
namespace CEGUI
{
class CGameUIScript : public ScriptModule
{
public:
CGameUIScript();
virtual ~CGameUIScript();
void executeScriptFile(const String& filename, const String& resourceGroup);
void executeScriptFile(const String& filename,
const String& resourceGroup,
const String& error_handler);
void executeScriptFile(const String& filename,
const String& resourceGroup,
const int error_handler);
int executeScriptGlobal(const String& function_name);
int executeScriptGlobal(const String& function_name,
const String& error_handler);
int executeScriptGlobal(const String& function_name,
const int error_handler);
bool executeScriptedEventHandler(const String& handler_name,
const EventArgs& e);
bool executeScriptedEventHandler(const String& handler_name,
const EventArgs& e,
const String& error_handler);
bool executeScriptedEventHandler(const String& handler_name,
const EventArgs& e,
const int error_handler);
void executeString(const String& str);
void executeString(const String& str, const String& error_handler);
void executeString(const String& str, const int error_handler);
Event::Connection subscribeEvent(EventSet* target, const String& name,
const String& subscriber_name);
Event::Connection subscribeEvent(EventSet* target, const String& name,
const String& subscriber_name,
const String& error_handler);
Event::Connection subscribeEvent(EventSet* target, const String& name,
const String& subscriber_name,
const int error_handler);
Event::Connection subscribeEvent(EventSet* target, const String& name,
Event::Group group,
const String& subscriber_name);
Event::Connection subscribeEvent(EventSet* target, const String& name,
Event::Group group,
const String& subscriber_name,
const String& error_handler);
Event::Connection subscribeEvent(EventSet* target, const String& name,
Event::Group group,
const String& subscriber_name,
const int error_handler);
void createBindings(void);
void destroyBindings(void);
};
}
//------------------------------------------------------------------------------
and I want to subscribe a luaplus event,the code as follow:
//-----------------------------------------------------------------------------------
Code: Select all
/*************************************************************************
Subscribe to a scripted event handler
*************************************************************************/
Event::Connection CGameUIScript::subscribeEvent(EventSet* target,
const String& event_name, const String& subscriber_name)
{
if(target)
{
ScriptFunctor functor(subscriber_name);
Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
return con;
}
throw ;
}
//------------------------------
but when I use vs2005 compile this project,one link error appear:
UIScript.obj : error LNK2019: can't solve extern symbol "public: bool __thiscall CEGUI::ScriptFunctor::operator()(class CEGUI::EventArgs const &)const " (??RScriptFunctor@CEGUI@@QBE_NABVEventArgs@1@@Z),this symbol is in "public: virtual bool __thiscall CEGUI::FunctorCopySlot<class CEGUI::ScriptFunctor>::operator()(class CEGUI::EventArgs const &)" (??R?FunctorCopySlot@VScriptFunctor@CEGUI@@@CEGUI@@UAE_NABVEventArgs@1@@Z) .....
i would appreciate any help!