1753808 Members
7626 Online
108805 Solutions
New Discussion юеВ

Re: cc bug function

 
MR GROSS
Occasional Advisor

cc bug function

Hell
I use the cc compiler on HPUX10.20.
i made a function
void main()
{ int fd;
fd =open ( "file",O_RDONLY);
close (fd);
}

And i have this error when compiling
cc: "file" line 6 error 1588 :
"O_RDONLY" undefined

can you help me, it is a wrong syntaxe or i need patch for my station ?
thanks

3 REPLIES 3
Santosh Nair_1
Honored Contributor

Re: cc bug function

Try including fcntl.h, i.e.:

#include

-Santosh
Life is what's happening while you're busy making other plans
A. Clay Stephenson
Acclaimed Contributor

Re: cc bug function

Hi Gross:


Your problem is that you have not told the c preprocessor where to look for defines. In this case the answer is fcntl.h (File Control).

You can save yourself quite a bit of trouble if you add these includes to just about all c programs.

#include
#include
#include

The <> tell tell c preprocess to look in the 'standard' locations or those defined with a -I cc option.

If it ain't broke, I can fix that.
MR GROSS
Occasional Advisor

Re: cc bug function

But I made it.