Re: Compilation Issue (640 Views)
Reply
Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 1 of 13 (642 Views)
Accepted Solution

Compilation Issue

When a compling a C file I am Getting the following errors.Could Some one help me to resolve the problem?
/ProdCommon/opt/aCC/include/cstdlib", line 14: error #2168: a function type
is not allowed here
inline long abs (long a) { return labs( a ); }
^

"/ProdCommon/opt/aCC/include/cstdlib", line 14: error #2065: expected a ";"
inline long abs (long a) { return labs( a ); }
^

"/ProdCommon/opt/aCC/include/cstdlib", line 15: warning #4347-D: "inline" is a
keyword in the C99 C Standard, and its usage as an identifier will
cause an error in C99 mode
inline ldiv_t div (long a, long b) { return ldiv( a, b ); }
^

"/ProdHome/fdnaperf/test/aml/utf8/include/fstring.h", line 17: warning #2012-D:
parsing restarts here after previous syntax error
_Number5_ f_strlen(const unsigned char *s);
^

"/ProdHome/fdnaperf/test/aml/utf8/include/fstring.h", line 21: error #2168: a
function type is not allowed here
_Number5_ f_strcmp(const unsigned char *s1, const unsigned char *s2);
^

"/ProdHome/fdnaperf/test/aml/utf8/include/fstring.h", line 25: error #2168: a
function type is not allowed here
_Number5_ f_strcpy(unsigned char *dst, const unsigned char *src);
^
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 2 of 13 (642 Views)

Re: Compilation Issue

This looks like you are compiling C++. You need to use aCC, not cc.

It also appears that you are using the -AP aC++ headers, not the default -AA ones.
Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 3 of 13 (642 Views)

Re: Compilation Issue

But I have even Compiled using aCC,still I am getting the same error.Could you please tell me how to use default -AA headers
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 4 of 13 (642 Views)

Re: Compilation Issue

>But I have even compiled using aCC, still I am getting the same error.

That can't happen unless you tell aCC that you are compiling C source with -Ae, -AC89 or -AC99.
What does you compile line look like?

>Could you please tell me how to use default -AA headers

Remove any -I paths that have: /ProdCommon/opt/aCC/include

Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 5 of 13 (642 Views)

Re: Compilation Issue

What does you compile line look like?

My compile line looks like this
aCC -D__hpux_ -D__hpux_ +Z -g -c -Ae

I even tried with
cc -D__hpux_ -D__hpux_ +Z -g -c -Ae

After removing -I paths that have: /ProdCommon/opt/aCC/include I am getting more errors which are listed below

/usr/include/stdio.h", line 263: error #2080: a storage class may not be
specified here
extern int sprintf(char *, const char *,...);
^

"/usr/include/stdio.h", line 263: error #2168: a function type is not allowed
here
extern int sprintf(char *, const char *,...);
^

"/usr/include/stdio.h", line 264: error #2080: a storage class may not be
specified here
extern int sscanf(const char *, const char *,...);
^

"/usr/include/stdio.h", line 264: error #2168: a function type is not allowed
here
extern int sscanf(const char *, const char *,...);
^

"/usr/include/stdio.h", line 265: error #2080: a storage class may not be
specified here
extern int fgetc(FILE *);
^

"/usr/include/stdio.h", line 265: error #2020: identifier "FILE" is undefined
extern int fgetc(FILE *);
^

"/usr/include/stdio.h", line 265: error #2168: a function type is not allowed
here
extern int fgetc(FILE *);
^

"/usr/include/stdio.h", line 266: error #2080: a storage class may not be
specified here
extern char *fgets(char *, int, FILE *);
^

"/usr/include/stdio.h", line 266: error #2020: identifier "FILE" is undefined
extern char *fgets(char *, int, FILE *);
^

"/usr/include/stdio.h", line 266: error #2168: a function type is not allowed
here
extern char *fgets(char *, int, FILE *);
^

"/usr/include/stdio.h", line 267: error #2080: a storage class may not be
specified here
extern int fputc(int, FILE *);
^

"/usr/include/stdio.h", line 267: error #2020: identifier "FILE" is undefined
extern int fputc(int, FILE *);
^

"/usr/include/stdio.h", line 267: error #2168: a function type is not allowed
here
extern int fputc(int, FILE *);
^

"/usr/include/stdio.h", line 268: error #2080: a storage class may not be
specified here
extern int fputs(const char *, FILE *);
^

"/usr/include/stdio.h", line 268: error #2020: identifier "FILE" is undefined
extern int fputs(const char *, FILE *);
^

"/usr/include/stdio.h", line 268: error #2168: a function type is not allowed
here
extern int fputs(const char *, FILE *);
^

"/usr/include/stdio.h", line 269: error #2080: a storage class may not be
specified here
extern int getc(FILE *);
^

"/usr/include/stdio.h", line 269: error #2020: identifier "FILE" is undefined
extern int getc(FILE *);
^

"/usr/include/stdio.h", line 269: error #2168: a function type is not allowed
here
extern int getc(FILE *);
^

"/usr/include/stdio.h", line 270: error #2080: a storage class may not be
specified here
extern int getchar(void);
^

"/usr/include/stdio.h", line 270: error #2168: a function type is not allowed
here
extern int getchar(void);
^

"/usr/include/stdio.h", line 271: error #2080: a storage class may not be
specified here
extern char *gets(char *);
^

"/usr/include/stdio.h", line 271: error #2168: a function type is not allowed
here
extern char *gets(char *);
^

"/usr/include/stdio.h", line 272: error #2080: a storage class may not be
specified here
extern int putc(int, FILE *);
^

"/usr/include/stdio.h", line 272: error #2020: identifier "FILE" is undefined
extern int putc(int, FILE *);
^

"/usr/include/stdio.h", line 272: error #2168: a function type is not allowed
here
extern int putc(int, FILE *);
^

"/usr/include/stdio.h", line 273: error #2080: a storage class may not be
specified here
extern int putchar(int);
^

"/usr/include/stdio.h", line 273: error #2168: a function type is not allowed
here
extern int putchar(int);
^

"/usr/include/stdio.h", line 274: error #2080: a storage class may not be
specified here
extern int puts(const char *);
^

"/usr/include/stdio.h", line 274: error #2168: a function type is not allowed
here
extern int puts(const char *);
^

"/usr/include/stdio.h", line 275: error #2080: a storage class may not be
specified here
extern int ungetc(int, FILE *);
^

"/usr/include/stdio.h", line 275: error #2020: identifier "FILE" is undefined
extern int ungetc(int, FILE *);
^

"/usr/include/stdio.h", line 275: error #2168: a function type is not allowed
here
extern int ungetc(int, FILE *);
^

"/usr/include/stdio.h", line 282: error #2080: a storage class may not be
specified here
extern FILE *tmpfile(void);
^

"/usr/include/stdio.h", line 282: error #2020: identifier "FILE" is undefined
extern FILE *tmpfile(void);
^

"/usr/include/stdio.h", line 282: error #2168: a function type is not allowed
here
extern FILE *tmpfile(void);
^

"/usr/include/stdio.h", line 283: error #2080: a storage class may not be
specified here
extern int fgetpos(FILE *, fpos_t *);
^

"/usr/include/stdio.h", line 283: error #2020: identifier "FILE" is undefined
extern int fgetpos(FILE *, fpos_t *);
^

"/usr/include/stdio.h", line 283: error #2168: a function type is not allowed
here
extern int fgetpos(FILE *, fpos_t *);
^

"/usr/include/stdio.h", line 284: error #2080: a storage class may not be
specified here
extern int fsetpos(FILE *, const fpos_t *);
^

"/usr/include/stdio.h", line 284: error #2020: identifier "FILE" is undefined
extern int fsetpos(FILE *, const fpos_t *);
^

"/usr/include/stdio.h", line 284: error #2168: a function type is not allowed
here
extern int fsetpos(FILE *, const fpos_t *);
^

"/usr/include/stdio.h", line 285: error #2080: a storage class may not be
specified here
extern FILE *fopen(const char *, const char *);
^

"/usr/include/stdio.h", line 285: error #2020: identifier "FILE" is undefined
extern FILE *fopen(const char *, const char *);
^

"/usr/include/stdio.h", line 285: error #2168: a function type is not allowed
here
extern FILE *fopen(const char *, const char *);
^

"/usr/include/stdio.h", line 286: error #2080: a storage class may not be
specified here
extern FILE *freopen(const char *, const char *, FILE *);
^

"/usr/include/stdio.h", line 286: error #2020: identifier "FILE" is undefined
extern FILE *freopen(const char *, const char *, FILE *);
^

"/usr/include/stdio.h", line 286: error #2020: identifier "FILE" is undefined
extern FILE *freopen(const char *, const char *, FILE *);
^

"/usr/include/stdio.h", line 286: error #2168: a function type is not allowed
here
extern FILE *freopen(const char *, const char *, FILE *);
^

"/usr/include/stdio.h", line 296: error #2080: a storage class may not be
specified here
extern int fseek(FILE *, long int, int);
^

"/usr/include/stdio.h", line 296: error #2020: identifier "FILE" is undefined
extern int fseek(FILE *, long int, int);
^

"/usr/include/stdio.h", line 296: error #2168: a function type is not allowed
here
extern int fseek(FILE *, long int, int);
^

"/usr/include/stdio.h", line 297: error #2080: a storage class may not be
specified here
extern long int ftell(FILE *);
^

"/usr/include/stdio.h", line 297: error #2020: identifier "FILE" is undefined
extern long int ftell(FILE *);
^

"/usr/include/stdio.h", line 297: error #2168: a function type is not allowed
here
extern long int ftell(FILE *);
^

"/usr/include/stdio.h", line 298: error #2080: a storage class may not be
specified here
extern void rewind(FILE *);
^

"/usr/include/stdio.h", line 298: error #2020: identifier "FILE" is undefined
extern void rewind(FILE *);
^

"/usr/include/stdio.h", line 298: error #2168: a function type is not allowed
here
extern void rewind(FILE *);
^

"/usr/include/stdio.h", line 299: error #2080: a storage class may not be
specified here
extern void clearerr(FILE *);
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 6 of 13 (642 Views)

Re: Compilation Issue

>My compile line looks like this: aCC -D__hpux_ +Z -g -c -Ae

Why are you using -Ae, I mentioned that would cause the problem by switching to C mode.

Who is testing __hpux_? The compiler automatically sets __hpux.

>I am getting more errors which are listed below

Hmm, those don't look the errors you get when compiling C++ source with C, especially for /usr/include/stdio.h. It could be an evil macro problem?
Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 7 of 13 (642 Views)

Re: Compilation Issue

Do you have any suggestion on resolving this problem?
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 8 of 13 (642 Views)

Re: Compilation Issue

>Do you have any suggestion on resolving this problem?

Is this C or C++?
If evil macro, compile with +legacy_cpp and see what errors you get.
Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 9 of 13 (642 Views)

Re: Compilation Issue

Is this C or C++?
This is C program

Afer compiling with +legacy_cpp .I am getting the following error

cc: internal error 1901: cannot exec /opt/langtools/lbin/cpp.ansi: 2 (No such file or directory)
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 10 of 13 (642 Views)

Re: Compilation Issue

cc: internal error 1901: cannot exec /opt/langtools/lbin/cpp.ansi: 2 (No such file or directory)

Where is the compiler installed?
If it is in /ProdCommon/opt/aCC, you will have to use:
+legacy_cpp=/ProdCommon/opt/langtools/lbin/cpp.ansi
Occasional Advisor
Santhosh Kurian_1
Posts: 6
Registered: ‎03-15-2009
Message 11 of 13 (640 Views)

Re: Compilation Issue

The result after adding the flag is

cc: internal error 1901: cannot exec /ProdCommon/opt/langtools/lbin/cpp.ansi: 2 (No such file or directory)
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 12 of 13 (640 Views)

Re: Compilation Issue

Again: Where is the compiler installed?
Why do you have headers in this directory tree: /ProdCommon/opt/aCC

If you have an official installation of aC++, you must also have /opt/langtools/lbin/cpp.ansi.
Acclaimed Contributor
Dennis Handly
Posts: 25,277
Registered: ‎03-06-2006
Message 13 of 13 (640 Views)

Re: Compilation Issue

While you are tracking down cpp.ansi, you could compile with "-E -.i" to get a .i file.

(Then you can look at that .i file for anything unusual around those errors.)

Then you can compile that .i file instead of your .c. This will show the expanded macros in the error messages.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.