Operating System - Linux
1826399 Members
4356 Online
109692 Solutions
New Discussion

Re: Getting error " error #2029: expected an expression" while compiling C code for va_arg

 
bruneau
Occasional Advisor

Getting error " error #2029: expected an expression" while compiling C code for va_arg

Hi !

while i m compiling my program i keep getting this kind of error:
======================
line 1662: error #2029: expected an expression
strcpy(ch,va_arg(ap,char *));
======================
Pointing out char * as the trouble parameters.

I have made a little program using va_arg and it builds just fine.

So I m searching why i have this problem since this code run for years now on HP-UX

We just migrate to Itanuim, with the evaluation package :
B9007AAEVAL C.11.31.03.EVAL2 HP C/aC++ Developer's Bundle for Evaluation License

Do someone have an idea about this problem ?
Syntax for build :
cc -c -I. -I/home/proj/inc appli.c -o appli.o

By advance.
Thank you
xbruneau
4 REPLIES 4
Sandman!
Honored Contributor

Re: Getting error " error #2029: expected an expression" while compiling C code for va_arg

Break it up into parts so that it is easier to troubleshoot and if it compiles viz.,

const char *ch;
char *ch2;

ch2 = va_arg(ap, char *);
strcpy(ch, (const char *)ch2);
bruneau
Occasional Advisor

Re: Getting error " error #2029: expected an expression" while compiling C code for va_arg

Thank you for the anwser.

in fact i already have this kind of error.
=============
va_list ap;

-------
line 1268: error #2029: expected an expression
va_arg(ap, char);
^
=============

(also I have tried your modification to be sure)

In fact... an internal procedure from our software added the line
#define _PA_RISC2_0
before generating the final .c file....

So, not a bug , just a definition that do not have to be here.....

Thank you for you answer
And sorry for having opening such a case.







xbruneau
bruneau
Occasional Advisor

Re: Getting error " error #2029: expected an expression" while compiling C code for va_arg

My mistake.

All is ok now.
Thank you for your help !
xbruneau
Dennis Handly
Acclaimed Contributor

Re: Getting error " error #2029: expected an expression" while compiling C code for va_arg

>an internal procedure from our software added the line: #define _PA_RISC2_0

Yes, that would change so that the IPF compiler wouldn't know what to do.