Subcrition event woes

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

Ninja
Quite a regular
Quite a regular
Posts: 86
Joined: Sun Aug 20, 2006 11:42

Subcrition event woes

Postby Ninja » Mon Aug 28, 2006 18:14

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

User avatar
Ludi
Quite a regular
Quite a regular
Posts: 59
Joined: Sun Aug 13, 2006 12:33

Postby Ludi » Mon Aug 28, 2006 19:33

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

Ninja
Quite a regular
Quite a regular
Posts: 86
Joined: Sun Aug 20, 2006 11:42

Postby Ninja » Mon Aug 28, 2006 19:56

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 ?

User avatar
Ludi
Quite a regular
Quite a regular
Posts: 59
Joined: Sun Aug 13, 2006 12:33

Postby Ludi » Mon Aug 28, 2006 20:12

Sorry, I can't help you with this problem as I'm using Lua, this is up to a CEGUI pro ;)

timmeh
Just popping in
Just popping in
Posts: 3
Joined: Mon Aug 28, 2006 03:31

Postby timmeh » Mon Aug 28, 2006 20:39

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->.

Ninja
Quite a regular
Quite a regular
Posts: 86
Joined: Sun Aug 20, 2006 11:42

Postby Ninja » Tue Aug 29, 2006 22:59

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

Sjizo
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Thu Aug 31, 2006 08:44

Postby Sjizo » Mon Sep 04, 2006 08:34

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.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Mon Sep 04, 2006 14:21

error C2673: 'WinMain' : global functions do not have 'this' pointers

this says it all.

Just omit the instance pointer for static functions

Sjizo
Not too shy to talk
Not too shy to talk
Posts: 30
Joined: Thu Aug 31, 2006 08:44

Postby Sjizo » Mon Sep 04, 2006 14:29

I fixed it now, rewrote some of the code to make it look better and put itin a class. Now it works fine.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests