Operating System - HP-UX
1833397 Members
3912 Online
110052 Solutions
New Discussion

erors in grep compilation

 
krish_8
Occasional Contributor

erors in grep compilation

hi,
I am compilling grep.c file using cc.I got the errors like bellow . also i gave the portion of "string.h" file .plz check it, how can i solve this ?
c -c grep.c
sr/include/string.h", line 104: error #2040: expected an identifier
extern char *strerror(int);
^

sr/include/string.h", line 104: error #2018: expected a ")"
extern char *strerror(int);
^

ep.c", line 1509: error #2020: identifier "PACKAGE_BUGREPORT" is undefined
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
^

ep.c", line 2097: error #2020: identifier "STDOUT_FILENO" is undefined
if(isatty(STDOUT_FILENO) && getenv("TERM") &&
^

ep.c", line 2181: error #2020: identifier "PACKAGE_STRING" is undefined
printf ("%s\n\n", PACKAGE_STRING);
^

rrors detected in the compilation of "grep.c".


"string.h" file :

/* These functions are defined in */
#endif /* defined(__HP_NO_STRING_OVERLOADS) || ... */
extern char *strtok(char *, const char *);
extern char *strerror(int);


4 REPLIES 4
krish_8
Occasional Contributor

Re: erors in grep compilation

hi,
Sorry , last time it is not fully copied.
errors are like this.

$ cc -c grep.c
"/usr/include/string.h", line 104: error #2040: expected an identifier
extern char *strerror(int);
^

"/usr/include/string.h", line 104: error #2018: expected a ")"
extern char *strerror(int);
^

"grep.c", line 1509: error #2020: identifier "PACKAGE_BUGREPORT" is undefined
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
^

"grep.c", line 2097: error #2020: identifier "STDOUT_FILENO" is undefined
if(isatty(STDOUT_FILENO) && getenv("TERM") &&
^

"grep.c", line 2181: error #2020: identifier "PACKAGE_STRING" is undefined
printf ("%s\n\n", PACKAGE_STRING);
^

5 errors detected in the compilation of "grep.c".
Dennis Handly
Acclaimed Contributor

Re: erors in grep compilation

>I got the errors like below. How can I solve this?

Are you using evil macros?
Compile with -H to get the include hierarchy.
Compile with -E -.i then look at grep.i to see what's going on with macros on line 104.

error #2020: identifier "PACKAGE_BUGREPORT" is undefined
error #2020: identifier "STDOUT_FILENO" is undefined
error #2020: identifier "PACKAGE_STRING" is undefined

Where should these be defined?
The middle one is indirectly from .
Steven Schweda
Honored Contributor

Re: erors in grep compilation

> I am compilling grep.c file using cc.

"grep.c" from where? Which "cc"? On what?

If this is part of a GNU "grep" kit, then you
might do better if you followed the
installation instructions (normally in
"INSTALL"), normally something like:

./configure
make

Otherwise, you might look for a pre-built kit
(depot) for your (undisclosed) OS.
Dennis Handly
Acclaimed Contributor

Re: erors in grep compilation

>Steven: Which "cc"? On what?

This is obviously aCC6 on 11.23/11.31 IPF system.