Custom events - sent from one class and recieved in another
Andrzej Duś Jr
gogoad at dakom.wielun.pl
Mon Sep 11 02:48:03 PDT 2006
Vadim Zeitlin wrote:
> On Sun, 10 Sep 2006 22:47:08 +0200 Andrzej Du¶ Jr <gogoad at dakom.wielun.pl> wrote:
>
> ADJ> ----- FILE x.h ----
> ADJ> DECLARE_EVENT_TYPE(EVT_GOT_EXT_APP_INPUT, -1)
>
> You need to use DEFINE_EVENT_TYPE() for ever DECLARE_EVENT_TYPE(), as
> samples/event shows.
Thanks for your response.
It doesn't work. Moving DEFINE_EVENT_TYPE() to header x.h or moving
DECLARE_EVENT_TYPE() + DEFINE_EVENT_TYPE() to both cpp files results in
similar linker error:
x.o:x.cpp:(.bss+0x0): multiple definition of `EVT_GOT_EXT_APP_INPUT'
y.o:y.cpp:(.bss+0x0): first defined here
It seems that doubling DEFINE_EVENT_TYPE() for one event causes this
error. This is what online manual says about custom events (in "Event
handling overview" section):
[...] this is done using the following macros:
// in the header of the source file
DECLARE_EVENT_TYPE(name, value)
// in the implementation
DEFINE_EVENT_TYPE(name)
As far as I understand this situation:
- DECLARE_EVENT_TYPE() is something like function declaration so it
should go into headers to provide informations for linker.
- DEFINE_EVENT_TYPE() is something like function defition so it is an
implementation
Did I miss something??
Also sample provided with wxwidgets does't resolve my problem, because
in this sample events aren't splitted into multiple files.
Take into consideration that my code was compiling perfectly well under
VC++ 7.0. This linker problem occurs under mingw32.
Any ideas??
--
Andrzej Duś Jr
http://gogoad.dakom.wielun.pl
More information about the wx-users
mailing list