Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

argp error during include

12 views
Skip to first unread message

pocm...@gmail.com

unread,
Jan 18, 2006, 7:18:59 AM1/18/06
to
Hi all,

I'm using argp and when I finally try to compile my C++ prog I get:
/usr/include/argp.h: In function `void argp_usage(const argp_state*)':
/usr/include/argp.h:565: error: declaration of `void argp_usage(const
argp_state*) throw ()' throws different exceptions
/usr/include/argp.h:502: error: than previous declaration `void
argp_usage(const argp_state*)'

I'm using g++ 3.3.4, glibc 2.3.5 and compiling with -Wall -std=c++98.

Any ideas why this is happening? Using extern "C" { #include <argp.h> }
won't help. :(

Cheers,

Paulo Matos

Paulo Matos

unread,
Jan 18, 2006, 9:38:50 AM1/18/06
to

Maxim Yegorushkin escreveu:

> The error says that the two declarations are not the same.
>
> The declaration
>
> void argp_usage(const argp_state*);
>
> is essentially a short form of
>
> void argp_usage(const argp_state*) throw(...);
>
> which is not the same as
>
> void argp_usage(const argp_state*) throw ();
>
> There must be something wrong with the header file or more likely with
> preprocessor definitions.

Indeed this is a strange issue. I can work out simple examples with
argp but in my program just blows. While trying to compile a bison
generated parser which indirectly includes argp with the following
flags (most added automaticly by autoconf/automake, do I need to have
anything for argp in configure.ac?):
g++ -DHAVE_CONFIG_H -I. -I. -I.. -ansi -std=c++98 -pedantic -Wall
-ggdb -I./include "-DBUILDDATE=\"`date +'%Y-%b-%d %R'`\"" -DESATLOG=5
-g -O2 -MT msat-parser.o -MD -MP -MF ".deps/msat-parser.Tpo" -c -o
msat-parser.pre msat-parser.cc

if I change -c to -E and check the preprocessed file I get the
following line where the warning shows up:
502: extern void argp_usage (const struct argp_state *__state);
503: extern void __argp_usage (const struct argp_state *__state);

...

# 563 "/usr/include/argp.h" 3 4
extern __inline__ void
argp_usage (const struct argp_state *__state) throw ()
{
argp_state_help (__state, stderr, (0x02 | 0x04 | 0x100));
}

Can it be because of inline? Is there any known issue on argp with
flex/bison or autoconf/automake specifics for argp?

Cheers,

Paulo Matos

Paulo Matos

unread,
Jan 18, 2006, 12:21:10 PM1/18/06
to
GOT IT!

Found the problem. The -O2 in conjuction with -pedantic generates the
error. Seems I'll drop -pedantic. :)

Cheers,

Paulo Matos

Paulo Matos escreveu:

Maxim Yegorushkin

unread,
Jan 19, 2006, 5:20:52 AM1/19/06
to

Paulo Matos wrote:

> Found the problem. The -O2 in conjuction with -pedantic generates the
> error. Seems I'll drop -pedantic. :)

You may report a bug against argp, since the header is inconsistent.

pocm...@gmail.com

unread,
Feb 2, 2006, 5:49:18 PM2/2/06
to
0 new messages