question on using random in C on FC4 (perhaps slightly OT)

Jakub Jelinek jakub at redhat.com
Wed Nov 16 15:05:34 UTC 2005


On Wed, Nov 16, 2005 at 09:00:33AM -0600, STYMA, ROBERT E (ROBERT) wrote:
> > So, ignoring this, I use the following in a random number 
> > generator program and
> > get the following while compilation....
> > 
> > gcc -c -O3 -std=c99 -Wall -pedantic random.c
> > random.c: In function 'setseed':
> > random.c:35: warning: implicit declaration of function 'srandom'
> > random.c: In function 'runi':
> > random.c:48: warning: implicit declaration of function 'random'
> > 
> > But I have included stdlib.h so what is the problem?
> >
> For whatever reason, the declare for srandom in 
> /usr/include/stdlib.h is surrounded by the #ifdef
> 
> #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD 

Run
info libc 'Feature Test Macros'
and read all it says on this matter.

	Jakub




More information about the fedora-list mailing list