Re: unresolved overloaded function type



jody wrote:
> Hi
> I have ported an application which compiled and worked well
> to another computer. When i compile it here i get the following error:
> 
> ImageDisplay.cpp: In static member function 'static void
> ImageDisplay::displayImage(ValReader*, bool, char*, char*)':
> ImageDisplay.cpp:84: error: call of overloaded 'ptr_fun(<unresolved
> overloaded function type>)' is ambiguous
> /usr/include/sigc++-2.0/sigc++/functors/ptr_fun.h:471: note:
> candidates are: sigc::pointer_functor1<T_arg1, T_return>
> sigc::ptr_fun(T_return (*)(T_arg1)) [with T_arg1 = GdkEventKey*,
> T_return = bool]
> /usr/include/sigc++-2.0/sigc++/functors/ptr_fun.h:482: note:
>       sigc::pointer_functor2<T_arg1, T_arg2, T_return>
> sigc::ptr_fun(T_return (*)(T_arg1, T_arg2)) [with T_arg1 = __pid_t,
> T_arg2 = int, T_return = int]
> 
> The offending call is:
>             win1.signal_key_press_event().connect(sigc::ptr_fun(&kill));
> which is called in a constructor of a class,
> and win1 is a Gtk::Window:
>  Gtk::Window win1;
> 
> kill is a global function:
>   bool kill(GdkEventKey *e) {
>       Gtk::Main::quit();
>       //    printf("Bye\n");
>       return true;
>   }
> Interestingly, a similar call preceding the one above
>        win1.signal_motion_notify_event().connect(sigc::ptr_fun(&coords));
> poses no problems. coords is
>   bool coords(GdkEventMotion *e);
> 
> I compile with the recommended  `pkg-config gtkmm-2.4 --cflags`
> 
> Is there any way to fix that problem?
> 
> Thank you
>   Jody
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list

My guess is that one of your #includes pulls in another function that is also called kill(), and the compiler can't tell which one of those versions of kill() you want to bind to the signal.  For instance, if I look in /usr/include, I find the following function definition in /usr/include/signal.h:

extern int kill (__pid_t __pid, int __sig) __THROW;

So one option is to rename your kill() function to something else.  There may be a way to explicitly specify which overload you want, but I"m not sure what the syntax is.  Somebody smarter than me will probably know though.


-- 
jonner


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]