Operating System - HP-UX
1833197 Members
2961 Online
110051 Solutions
New Discussion

need help to compile a C program

 
SOLVED
Go to solution
HPP
Regular Advisor

need help to compile a C program

Hi,
I need help to compile a C program on HP-UX 11.11. I was able successfully compile same program on Linux. Can somebody tell me what should i do based on the error below. I have attached the C program which i am trying to compile. Thanks.

gcc -D_HPUX_SOURCE -I/usr/local/include -O3 -I../.. -I../../lib -I../../lib/ctype -I../../lib/regexp/ -c field_y.c
field_y.c:335: error: syntax error before "fieldstype"
field_y.c:335: warning: no semicolon at end of struct or union
field_y.c:965: error: syntax error before "fieldstype"
field_y.c: In function `fielddestruct':
field_y.c:975: error: `fieldvaluep' undeclared (first use in this function)
field_y.c:975: error: (Each undeclared identifier is reported only once
field_y.c:975: error: for each function it appears in.)
field_y.c:977: error: `fieldmsg' undeclared (first use in this function)
field_y.c:981: error: `fieldtype' undeclared (first use in this function)
field_y.c: At top level:
field_y.c:1012: error: syntax error before "fieldlval"
field_y.c:1012: warning: data definition has no type or storage class
field_y.c: In function `fieldparse':
field_y.c:1064: error: `fieldstype' undeclared (first use in this function)
field_y.c:1064: error: syntax error before "fieldvsa"
field_y.c:1065: error: `fieldvs' undeclared (first use in this function)
field_y.c:1065: error: `fieldvsa' undeclared (first use in this function)
field_y.c:1066: error: `fieldvsp' undeclared (first use in this function)
field_y.c:1076: error: syntax error before "fieldval"
field_y.c:1153: error: invalid application of `sizeof' to incomplete type `fieldalloc'
field_y.c:1156: error: dereferencing pointer to incomplete type
field_y.c:1156: error: dereferencing pointer to incomplete type
field_y.c:1156: error: invalid application of `sizeof' to incomplete type `fieldalloc'
field_y.c:1156: error: dereferencing pointer to incomplete type
field_y.c:1156: error: invalid use of undefined type `union fieldalloc'
field_y.c:1157: error: dereferencing pointer to incomplete type
field_y.c:1157: error: dereferencing pointer to incomplete type
field_y.c:1157: error: invalid application of `sizeof' to incomplete type `fieldalloc'
field_y.c:1157: error: dereferencing pointer to incomplete type
field_y.c:1157: error: invalid use of undefined type `union fieldalloc'
field_y.c:1277: error: `fieldval' undeclared (first use in this function)
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
Be Teachable
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: need help to compile a C program

You have ported the output of yacc/bison (field_y.c) rather than porting the yacc source (field_y.y?) that generated this C source. If you will instead run the yacc/bison source through the HP-UX version of yacc/bison to generate an HP-UX version of field_y.c, I think your problems will disappear.
If it ain't broke, I can fix that.
HPP
Regular Advisor

Re: need help to compile a C program

Clay,
Thanks much for the great TIP. It worked!!!!!!!!!!!!!!!!!!!!

100 points for your answer.

Thanks again.
Be Teachable