Page 1 of 1

subscribeEvent produces error C2064

Posted: Sun Sep 11, 2011 11:50
by pighead10

Code: Select all

guiRoot->getChild("Root/AddMiner")->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&GameState::addMiner));


This line produces an error:

Code: Select all

c:\cegui\cegui\include\CEGUIFunctorCopySlot.h(51): error C2064: term does not evaluate to a function taking 1 arguments


Here is the function `GameState::addMiner`:

Code: Select all

void GameState::addMiner(const CEGUI::EventArgs &evt){
   player1Mgr->trackUnit(player1Mgr->getFaction()->getMiner());
}


It produces that error, and I've no idea why. please say if you need more details!

Here is the error in its entirety:

Code: Select all

c:\cegui\cegui\include\CEGUIFunctorCopySlot.h(51): error C2064: term does not evaluate to a function taking 1 arguments
1>          c:\cegui\cegui\include\CEGUIFunctorCopySlot.h(50) : while compiling class template member function 'bool CEGUI::FunctorCopySlot<T>::operator ()(const CEGUI::EventArgs &)'
1>          with
1>          [
1>              T=void (__thiscall GameState::* )(const CEGUI::EventArgs &)
1>          ]
1>          c:\cegui\cegui\include\CEGUISubscriberSlot.h(126) : see reference to class template instantiation 'CEGUI::FunctorCopySlot<T>' being compiled
1>          with
1>          [
1>              T=void (__thiscall GameState::* )(const CEGUI::EventArgs &)
1>          ]
1>          GameState.cpp(40) : see reference to function template instantiation 'CEGUI::SubscriberSlot::SubscriberSlot<void(__thiscall GameState::* )(const CEGUI::EventArgs &)>(const T &)' being compiled
1>          with
1>          [
1>              T=void (__thiscall GameState::* )(const CEGUI::EventArgs &)
1>          ]

Re: subscribeEvent produces error C2064

Posted: Sun Sep 11, 2011 14:38
by maori
heya

try

Code: Select all

guiRoot->getChild("Root/AddMiner")->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&GameState::addMiner, this));

Re: subscribeEvent produces error C2064

Posted: Sun Sep 11, 2011 15:29
by pighead10
It doesn't like it, "no instance of CEGUI::SubscriberSlot::SubscriberSlot matches the argument list"

Re: subscribeEvent produces error C2064

Posted: Sun Sep 11, 2011 15:50
by Kulik

Code: Select all

void GameState::addMiner(const CEGUI::EventArgs &evt){


should be

Code: Select all

bool GameState::addMiner(const CEGUI::EventArgs &evt){

Re: subscribeEvent produces error C2064

Posted: Sun Sep 11, 2011 15:57
by pighead10
Thanks!