[Xfc-dev] Signal-handling-question

Jeff Franks jcfranks at tpg.com.au
Wed Jul 27 12:41:16 CEST 2005


Johannes Zellner wrote:

>Here is the compiler output:
>
>g++ filestepper.cc -c -o filestepper.o -Wall -O2 `pkg-config xfcui-4.3 
>--cflags`In file included from filestepper.cc:163:
>/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h: In member 
>function `
>   typename sigc::adaptor_functor<T_functor>::deduce_result_type<T_arg1, 
>void,
>   void, void, void, void, void>::type
>   sigc::adaptor_functor<T_functor>::operator()(T_arg1) const [with T_arg1 =
>   const Xfc::Gdk::EventKey&, T_functor = sigc::bound_mem_functor1<bool,
>   FileStepper, Xfc::Gdk::EventCrossing&>]':
>/usr/include/sigc++-2.0/sigc++/functors/slot.h:136:   instantiated from 
>`static T_return sigc::internal::slot_call1<T_functor, T_return, 
>T_arg1>::call_it(sigc::internal::slot_rep*, typename 
>sigc::type_trait<T_arg3>::take) [with T_functor = 
>sigc::bound_mem_functor1<bool, FileStepper, Xfc::Gdk::EventCrossing&>, 
>T_return = bool, T_arg1 = const Xfc::Gdk::EventKey&]'
>/usr/include/sigc++-2.0/sigc++/functors/slot.h:144:   instantiated from 
>`static void*(* sigc::internal::slot_call1<T_functor, T_return, 
>T_arg1>::address())(void*) [with T_functor = 
>sigc::bound_mem_functor1<bool, FileStepper, Xfc::Gdk::EventCrossing&>, 
>T_return = bool, T_arg1 = const Xfc::Gdk::EventKey&]'
>/opt/lunar/xfce4/include/xfce4/xfc/glib/signals.hh:529:   instantiated 
>from here/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:84: 
>  
>
The next few lines report the relevant information

>error: no match for
>   call to `(sigc::bound_mem_functor1<bool, FileStepper,
>   Xfc::Gdk::EventCrossing&>) (const Xfc::Gdk::EventKey&)'
>/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1839: error: 
>  
>
Here the compiler is reporting that it can find 'no match' for your call 
to connect a function that takes a 'const Xfc::Gdk::EventKey&'.

>candidates are:
>   T_return sigc::bound_mem_functor1<T_return, T_obj,
>   T_arg1>::operator()(typename sigc::type_trait<T_arg3>::take) const [with
>   T_return = bool, T_obj = FileStepper, T_arg1 = Xfc::Gdk::EventCrossing&]
>make: *** [filestepper.o] Fehler 1
>  
>
Above the compiler is reporting that the candiate for the nearest match 
is your function that takes a non-const Xfc::Gdk::EventCrossing 
reference. Although the object type is wrong, it should be a 
Xfc::Gdk::EventKey object, it would still generate an error because the 
reference it is not declared const.

>The depending codelines are:
>
>[...]
>    entry = new Gtk::Entry(0);
>    entry->signal_activate().connect(sigc::mem_fun(this, 
>&FileStepper::go));    <--works fine
>    entry->signal_key_release_event().connect(sigc::mem_fun(this, 
>&FileStepper::gofor));  <--- errorline
>  
>
So, the problem appears to be your function signature... it should be

bool FileStepper::gofor(const Gdk::EventKey& event);

not 

bool FileStepper::gofor(Gdk::EventCrossing& event);

or

bool FileStepper::gofor(Gdk::EventKey& event);

>    hbox->pack_start(*entry, true, true, 0);
>    entry->show();
>[...]
>void FileStepper::go(void)
>[...]
>bool FileStepper::gofor(Gdk::EventCrossing& event)
>[...]
>
>thanks... Johannes
>
>Jeff Franks schrieb:
>
>  
>
Hope this solves your problem,
Jeff.

















More information about the Xfc-dev mailing list