Page 1 of 1
Subcrition event woes
Posted: Mon Aug 28, 2006 18:14
by Ninja
Hi guys
looking at the demo's etc
added a exit button on my new app and it has given me some errors on compile
any ideas on how to fix this heres the button code
Code: Select all
PushButton* btn = static_cast<PushButton*>(winMgr.createWindow("TaharezLook/Button", "Quit"));
sheet->addChildWindow(btn);
btn->setMaximumSize(Size(1.0f, 1.0f));
btn->setPosition(Point(0.001f, 0.95f));
btn->setSize(Size(0.1f, 0.035f));
btn->setText("Exit");
subscribeEvent(PushButton::EventClicked, Event::Subscriber(&main::handleQuit, this));
and heres the errors
error C2653: 'SDL_main' : is not a class or namespace name
error C2065: 'handleQuit' : undeclared identifier
error C2673: 'SDL_main' : global functions do not have 'this' pointers
error C3861: 'subscribeEvent': identifier not found, even with argument-dependent lookup
TIA
Posted: Mon Aug 28, 2006 19:33
by Ludi
SDL has a main makro, which replaces the entry function int main(argc..., argv...) with one of it's own "callbacks", as SDL has it's own main function.
To make it short: Rename your main class to something else, e.g. Main, oder TheMain, or whatever
Posted: Mon Aug 28, 2006 19:56
by Ninja
Ludi
Thanks for the reply tried what you suggested and am getting
error C2673: 'MainUI' : global functions do not have 'this' pointers
error C2661: 'CEGUI::SubscriberTemplate<Ret,Args>::__ctor' : no overloaded function takes 2 arguments
with
[
Ret=bool,
Args=const CEGUI::EventArgs &
]
and
[
Ret=bool,
Args=const CEGUI::EventArgs &
]
error C3861: 'subscribeEvent': identifier not found, even with argument-dependent lookup
any ideas where i messed up ?
Posted: Mon Aug 28, 2006 20:12
by Ludi
Sorry, I can't help you with this problem as I'm using Lua, this is up to a CEGUI pro

Posted: Mon Aug 28, 2006 20:39
by timmeh
These all look like basic coding syntax errors.
error C2673: 'MainUI' : global functions do not have 'this' pointers
You can't use 'this' in a global function. Either move this code to an class method or pass something other than 'this'.
error C2661: 'CEGUI::SubscriberTemplate<Ret,Args>::__ctor' : no overloaded function takes 2 arguments
Check that your definition of handleQuit
exactly matches the required definition. I've made this mistake a couple of times recently myself when I forgot to declare the EventArgs & argument as const.
error C3861: 'subscribeEvent': identifier not found, even with argument-dependent lookup
subscribeEvent is a member function of a CEGUI class. In the code you posted above just add btn->.
Posted: Tue Aug 29, 2006 22:59
by Ninja
heya
Thanks for the replies
it compiles fine now
but the subscribeEvent
doesnt seem to be passed ie on pressing the exit button nothing happens
any ideas ?
TIA
Posted: Mon Sep 04, 2006 08:34
by Sjizo
Sorry to steal you topic but I found it useless to start a new topic when I have almost the same problem as you have. I also get
Code: Select all
1>.\Lesson1.cpp(231) : error C2673: 'WinMain' : global functions do not have 'this' pointers
1>.\Lesson1.cpp(231) : error C2661: 'CEGUI::SubscriberTemplate<Ret,Args>::SubscriberTemplate' : no overloaded function takes 2 arguments
1> with
1> [
1> Ret=bool,
1> Args=const CEGUI::EventArgs &
1> ]
What did you pass instead of this, I can't figure that out.
Posted: Mon Sep 04, 2006 14:21
by lindquist
error C2673: 'WinMain' : global functions do not have 'this' pointers
this says it all.
Just omit the instance pointer for static functions
Posted: Mon Sep 04, 2006 14:29
by Sjizo
I fixed it now, rewrote some of the code to make it look better and put itin a class. Now it works fine.