Operating System - HP-UX
1834253 Members
2196 Online
110066 Solutions
New Discussion

Re: cc compilation error after install B3901BA

 
SOLVED
Go to solution
Liu, yuhyun Marjorie
Occasional Advisor

cc compilation error after install B3901BA

Hello,
I just installed B3901BA ( B11.11.14) on our HP-UX 11.11.
I tried to recompile existing applications, and get an error ..

cc: "/sas/code/utils/tlm.h", line59: error 1000: Unexpected symbol: "-".
*** Error exit code 1

Stop.
when I checked the tlm.h file, it does not have "-" around.

Our HP server is 9000/800/rp3410, 64-bit machine.

The codes around line 59 are:

typedef enum
{
NO_VIOLATION = 0,
CRITICAL_LOW,
MARGINAL_LOW,
NOMINAL,
MARGINAL_HIGH,
CRITICAL_HIGH,
INVALID, <----- line 59
UPDATING
} VIOLATION_STATES;

As far as I remember when we have B11.00.xx version C/ANSI C compiler, there is no such problem.

Also, we need a C compiler to install oracle software.

Please give me some hint, and help
Thanks,

Marjorie Liu
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: cc compilation error after install B3901BA

My best guess is than a previously included header file has a #define for "INVALID" that is interfering. I would compile with the -P (I think) option which will produce a ".i" (I think) file which is the output of the c preprocessor before it is sent to the actual compiler.

e.g. cc -P myfile.c
should produce myfile.i. Examine it to see what macro expansions/substitutions have taken place.

Man cc to make sure that I have the correct cc options because I a doing this from memory.
If it ain't broke, I can fix that.
Liu, yuhyun Marjorie
Occasional Advisor

Re: cc compilation error after install B3901BA

Hello,
I compiled with -P option and created a display.i file.

after checking the content, the section

typedef enum
{
NO_VIOLATION = 0,
CRITICAL_LOW,
MARGINAL_LOW,
NOMINAL,
MARGINAL_HIGH,
CRITICAL_HIGH,
-1, <----- line 59
UPDATING
} VIOLATION_STATES;

which is not right.

How do I find out where the INVALID is defined or replaced?
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: cc compilation error after install B3901BA

You need to grep each of the specified #include'ed files (which might in turn contain #include directives) for "INVALID".

You are looking for a statement like this:
#define INVALID -1

or it may simply be a compiler flag like this
cc -DINVALID=-1 myfile.c
so have a close look at your makefile.
If it ain't broke, I can fix that.
Liu, yuhyun Marjorie
Occasional Advisor

Re: cc compilation error after install B3901BA

I found the line

#define INVALID -1

in a header file.

This solved the problem.

Thank you so much.
Marjorie
A. Clay Stephenson
Acclaimed Contributor

Re: cc compilation error after install B3901BA

By the way, you can add the -C option along with -P and it will leave the comments in. Most header files have their names in comments so you should be able to track down the #define.

cc -P -C myfile.c

Now examine myfile.i and you should have a much better idea where in the #include chain the substitution is occuring.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: cc compilation error after install B3901BA

By the way, if you ever encounter a problem like this again, you can fix it by simply
doing an:
#undef INVALID
just before your enum statement or whatever
block of code applies. This is much better than "fixing" a standard #include file because almost certainly if you commented out a #define in a header, you broke an application that depends upon that define.
If it ain't broke, I can fix that.
Liu, yuhyun Marjorie
Occasional Advisor

Re: cc compilation error after install B3901BA

Yes, the -C option does help. But the -P option for C preprocessor expansion to see all the lines is more useful.

thanks for the speedy response. very grateful.
Liu, yuhyun Marjorie
Occasional Advisor

Re: cc compilation error after install B3901BA

Thanks for all the help