You are not emitting signals correctly. This is the typesafety of a signals and slots system like libsigc++ helping you out :)
For example, you define the onCreate signal as such: sigc::signal<bool, dtk::widget, void*> onCreate This means that any slot connected to it must take a dtk::widget and void * as parameters and return a boolean. It also means that when you emit the signal, you need to pass a dtk::widget and a void * to the signal. So: widget::widget(void) { onCreate(this, 0); } Note that this will NOT compile either. I'm passing a dtk::widget * in to the signal, not a dtk::widget. I'm assuming thats what you mean to do (or perhaps a dtk::widget &). If you were to pass a dtk::widget in, a copy of the widget would be created and passed in. And since you don't define a copy constructor, the default constructor would be called...which would emit the signal, which would call a constructor, which would emit a signal, etc. Basically, you have to give the proper parameters to the signal when you emit. Nick On 3/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > sorry if my question is stupid but, why does libsigc++ not work for me? > > Here is the files I use: > The Header: > ... > #include <sigc++/sigc++.h> > > namespace dtk > { > > typedef enum { > DTK_WDG_HIDED = 0, > DTK_WDG_SHOWN = 1 > }wdg_state; > > class widget : protected eventReceiver > { > > public: > widget(); > virtual ~widget(); > virtual void draw(); > virtual void redraw(int width=0, int height=0); > virtual void show(); > virtual void hide(); > virtual void dock(IDirectFBSurface& dfb_surface); > virtual IDirectFBSurface* undock(); > > //Slots > sigc::signal<bool, dtk::widget, void*> onCreate; > sigc::signal<bool, dtk::widget, void*> onDestroy; > sigc::signal<bool, dtk::widget, void*> onDraw; > sigc::signal<bool, dtk::widget, void*> onShow; > sigc::signal<bool, dtk::widget, void*> onHide; > sigc::signal<bool, dtk::widget, void*> onDock; > sigc::signal<bool, dtk::widget, void*> onUndock; > //Actions > //None for the moment > .... > > The Implementation: > > #include "widget.h" > > namespace dtk > { > > widget::widget() > { > onCreate(); > } > > > widget::~widget() > { > onDestroy(); > } > > ... > > And when I try to compile my file, here is the result: > if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" > -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"DTK\" > -DVERSION=\"0.0.1\" -I. -I. -D_REENTRANT -I/usr/include/++dfb > -I/usr/include/directfb -I/usr/include/sigc++-2.0 > -I/usr/lib/sigc++-2.0/include -DDATADIR=\"/usr/share\" -DPACKAGE=\"DTK\" > -Wall -O2 -pipe -MT widget.o -MD -MP -MF ".deps/widget.Tpo" -c -o widget.o > widget.cpp; \ > then mv -f ".deps/widget.Tpo" ".deps/widget.Po"; else rm -f > ".deps/widget.Tpo"; exit 1; fi > event.h:31: warning: 'class dtk::eventReceiver' has virtual functions but > non-virtual destructor > widget.cpp: In constructor 'dtk::widget::widget()': > widget.cpp:29: error: no matching function for call to 'sigc::signal<bool, > dtk::widget, void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, > sigc::nil>::emit()' > /usr/include/sigc++-2.0/sigc++/signal.h:1923: note: candidates are: typename > sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::emit(typename sigc::type_trait<T_derived>::take, typename > sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 = > dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In destructor 'virtual dtk::widget::~widget()': > widget.cpp:35: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual void dtk::widget::draw()': > widget.cpp:42: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual void dtk::widget::redraw(int, int)': > widget.cpp:49: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual void dtk::widget::show()': > widget.cpp:56: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual void dtk::widget::hide()': > widget.cpp:63: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual void > dtk::widget::dock(IDirectFBSurface&)': > widget.cpp:70: error: cannot convert 'IDirectFBSurface**' to > 'IDirectFBSurface*' in assignment > widget.cpp:71: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > widget.cpp: In member function 'virtual IDirectFBSurface* > dtk::widget::undock()': > widget.cpp:80: error: no match for call to '(sigc::signal<bool, dtk::widget, > void*, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>) > ()'/usr/include/sigc++-2.0/sigc++/signal.h:1927: note: candidates are: > typename sigc::internal::signal_emit2<T_return, T_arg1, T_arg2, > T_accumulator>::result_type sigc::signal2<T_return, T_arg1, T_arg2, > T_accumulator>::operator()(typename sigc::type_trait<T_derived>::take, > typename sigc::type_trait<T_arg3>::take) const [with T_return = bool, T_arg1 > = dtk::widget, T_arg2 = void*, T_accumulator = sigc::nil] > make[1]: *** [widget.o] Error 1 > > > Can someone help me? > Many thanks. > > Ps: I'm using gcc-4.0.2 on a gentoo box, don't know if it change something > _______________________________________________ > libsigc-list mailing list > libsigc-list@gnome.org > http://mail.gnome.org/mailman/listinfo/libsigc-list > _______________________________________________ libsigc-list mailing list libsigc-list@gnome.org http://mail.gnome.org/mailman/listinfo/libsigc-list