[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-gengetopt] gengetopt C example
From: |
Tong Sun |
Subject: |
Re: [help-gengetopt] gengetopt C example |
Date: |
Thu, 24 Oct 2013 11:35:24 -0700 (PDT) |
On Thursday, 24 October 2013, 14:27, Tong Sun <address@hidden> wrote:
Thanks for your reply, Lorenzo.
[Retry again]
> please also file a bug report for gengetopt so that I can keep track of
> that.
Sure, will do after I go home tonight. Also the "Segmentation fault" bug
that I'll report later.
> If I remember correctly, that example generates a file that expected a
> PACKAGE and VERSION passed on the compilation command line, e.g.,
>
> gcc -DPACKAGE="..." -DVERSION="..."
That didn't work, but
gcc -DPACKAGE='"..."' -DVERSION="..."
works.
> this should be documented in the manual.
OK, here are the things need to be changed:
,-----
| From /usr/share/doc/gengetopt/examples/README.example:
|
| ...
|
| # commands to try the C example:
|
| gengetopt --input=sample2.ggo --func-name=my_cmdline_parser
| --file-name=cmdline2 --unamed-opts
| gcc -o main2 main2.c cmdline2.c
| ./main2 -h
| ...
`-----
the C example that come with the Debian/Ubuntu package
was generated with a different command line:
gengetopt --input=./sample2.ggo --func-name=my_cmdline_parser
--file-name=cmdline2 --unamed-opts --no-handle-help --no-handle-version
To compile,
gcc -DPACKAGE='"cmdline2"' -DVERSION="1.1" -o main2 main2.c cmdline2.c