gcc does not work with va_arg on irix 6.5

Patrick Therien ptherie@uswest.com
Wed Dec 22 14:19:00 GMT 1999


Try adding #include <sys/varargs.h>

Betty wrote:

> Hello,everyone,
>
> I have the following C code:
>
> /*file va-arg.c*/
> #include <stdarg.h>
>
> void f1(int n, ...)
> {
>     va_list ap;
>     int  i;
>     char a;
>
>     va_start(ap,n );
>
>     a=va_arg(ap,char);
>     i=va_arg(ap,int);
>
>     va_end(ap);
> }
>
> int main()
> {
>    char a='a';
>    int i=1;
>
>    f1(2, a,i);
>
>    return 0;
> }
>
> When I compile it on irix 6.5 using gcc 2.8.1 or gcc 2.95.2, it gives
> me the followings errors:
>
> va-arg.c: In function `f1':
> va-arg.c:11: parse error before `char'
> va-arg.c:11: parse error before `char'
> va-arg.c:11: parse error before `char'
> va-arg.c:11: parse error before `char'
> va-arg.c:11: parse error before `char'
> va-arg.c:11: parse error before `)'
> va-arg.c:12: parse error before `int'
> va-arg.c:12: parse error before `int'
> va-arg.c:12: parse error before `int'
> va-arg.c:12: parse error before `int'
> va-arg.c:12: parse error before `int'
> va-arg.c:12: parse error before `)'
>
> Any idea how to make va_arg work on irix 6.5 with gcc?
>
> Thank you for your help.
>
> Betty
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.


More information about the Gcc-help mailing list