Re: Using G_OPTION_ARG_CALLBACK



Le lundi 03 avril 2006 �2:22 +1000, Randima Niroshini a �it :
> Hi all,
> 
> I used "G_OPTION_ARG_CALLBACK" to denote one commandline argument, but it gives
> the following error.
> 
> ./parser.cc:95: error: invalid conversion from 'gboolean (*)(const char*, const
> char*, void*, GError**)' to 'void*'
> 
> Am I missing out something here?
> 
> static gboolean
> gparse_cb (const char *key, const char *value, gpointer user_data, GError **error)
> {
>   
> 
>   return TRUE;
> }
> 
> static GOptionEntry options[] = {
>   { "verbose", 0, 0, G_OPTION_ARG_NONE, &gbverbose, "Add verbose output to
> standard log", NULL },
>   { "version", 0, 0, G_OPTION_ARG_NONE, &gbversion, "Print version information
> on standard output", NULL },
>   { "parse", 0, 0, G_OPTION_ARG_CALLBACK, gparse_cb, "Parse the program, print
> errors on standard error", NULL },   
>   {NULL}
> };

use:
  { "parse", 0, 0, G_OPTION_ARG_CALLBACK, (void*) gparse_cb, "Parse the
program, print errors on standard error", NULL },   

You might also use void gparse_cb. AFAIK, the returned value will not be
used.




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