[gccsdk] mk project

John Tytgat John.Tytgat at aaug.net
Tue May 4 15:26:37 PDT 2010


In message <8c452c1251.beeb at ron1954.woosh.co.nz>
          Ron <beeb at woosh.co.nz> wrote:

> In message <20100504125649.A1DA75B9F at blake.inputplus.co.uk> you wrote:
> 
> > 
> > Hi Ron,
> > 
> > > unix.c: In function 'maketmp':
> > > unix.c:297: warning: implicit declaration of function 'mkstemp'
> > 
> > This is saying a call to mkstemp() is occurring without a function
> > prototype being seen that declares its arguments and return type;  an
> > implicit declaration rather than explicit is being used.
> > 
> > The prototype for mkstemp() can be found by `#include <stdlib.h>'.
> > 
> > Cheers,
> > Ralph.
> > 
> Thanks for the reply to my first posting Ralph, a bit in the dark.
> I thought the Unixlib libs were included by default when you run
> gcc?

Yes, UnixLib library is automatically added when linking (unless you're
using SharedCLibrary of course).  But that does not mean its headers
are automatically included when compiling.

> Anyway, I tried #include <stdlib.h> and it still gets the error.
> I think the name mkstemp sounds like it is a mk variable.
> I entered a declaration 'int mkstemp();' below the 'int fd:'
> and it satisfied the compiler, (no warning) but I am unsure
> how correct this is and it hasn't changed the behavior of mk.

Actually you're highlighting an UnixLib bug here.  It is supposed to
be prototyped in stdlib.h but is actually wrongly done in stdio.h.  I'll
fix that for the next release.

In the meanwhile, a cleaner and temporary solution is to add
'#include <stdio.h>' instead of your own prototype.

John.
-- 
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven




More information about the gcc mailing list