Re: [Vala] Need Help with GLib.OptionEntry
- From: "K. König" <kkoenig posteo de>
- To: vala-list gnome org
- Subject: Re: [Vala] Need Help with GLib.OptionEntry
- Date: Mon, 18 Apr 2011 18:53:19 +0200
Am Mon, 18 Apr 2011 18:17:38 +0200 (MEST)
schrieb "Gilzad Hamuni" <nt inorganic de>:
this is happening, because you left out the third field in each entry
of your array, which corresponds to the option flags:
http://developer.gnome.org/glib/2.28/glib-Commandline-option-parser.html#GOptionFlags
Oh, thank you, that's it.
Regards,
Karsten
----- original Nachricht --------
Betreff: [Vala] Need Help with GLib.OptionEntry
Gesendet: Mo, 18. Apr 2011
Von: K. König<kkoenig posteo de>
Hi,
I write a program which need command line arguments. I want to
implement this feature with the command line parser of the GLib. I
read the C and the Vala reference of the related topics but get an
error with the C compiler. Maybe knows somebody what goes wrong.
Error messages:
error: incompatible types when initializing type ‘enum <anonymous>’
using type ‘char **’
error: incompatible types when initializing type ‘enum <anonymous>’
using type ‘gboolean *’
error: incompatible types when initializing type ‘enum <anonymous>’
using type ‘gboolean *’
error: incompatible types when initializing type ‘enum <anonymous>’
using type ‘gint *’
An here is the related code:
string pre;
string post;
string filename;
bool interactive;
bool conserve;
int start;
const OptionEntry[] entries = {
{ "pre", 0, 1, OptionArg.STRING, ref pre, "set prefix that will
be placed to the left of the number", "PREFIX" }, { "post", 0, 1,
OptionArg.STRING, ref post, "set postfix that will be placed to the
left of the number", "POSTFIX" }, { "list", 'l', OptionArg.FILENAME,
ref filename, "use a list of files instead of all files in the
directory", "LIST" }, { "interactive", 'i', OptionArg.NONE, ref
interactive, "choose which files should be renamed interactive",
null }, { "conserve", 'c', OptionArg.NONE, ref conserve, "conserve
file extension", null }, { "start", 's', OptionArg.INT, ref start,
"set startnumber", "START" } };
static int main(string[] args) {
var opt_context = new OptionContext("- Options for
simpleRenamer");
opt_context.set_help_enabled(true);
opt_context.add_main_entries(entries, null);
try {
opt_context.parse(ref args);
}
catch(OptionError error) {
stdout.printf("%s", error.message);
}
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]