1748181 Members
4131 Online
108759 Solutions
New Discussion юеВ

Re: Compilation Issue

 
SOLVED
Go to solution
Santhosh Kurian_1
Occasional Advisor

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);
^
12 REPLIES 12
Dennis Handly
Acclaimed Contributor
Solution

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.
Santhosh Kurian_1
Occasional Advisor

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
Dennis Handly
Acclaimed Contributor

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

Santhosh Kurian_1
Occasional Advisor

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 *);
Dennis Handly
Acclaimed Contributor

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?
Santhosh Kurian_1
Occasional Advisor

Re: Compilation Issue

Do you have any suggestion on resolving this problem?
Dennis Handly
Acclaimed Contributor

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.
Santhosh Kurian_1
Occasional Advisor

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)
Dennis Handly
Acclaimed Contributor

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