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

Andy Green andy at warmcat.com
Wed Nov 16 14:56:51 UTC 2005


Globe Trotter wrote:

> 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?

Can we see the first 50 lines of your code?

      1 #include <stdlib.h>
      2 #include <stdio.h>
      3
      4 int main() {
      5         printf("%ld\n", random());
      6         return 0;
      7 }

gcc -c -O3 -Wall -pedantic test.c

works fine here with no errors or warnings.

$ gcc --version
gcc (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5)

Is your $INCLUDE set in your shell and you pick up a different stdlib.h?

-Andy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4492 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20051116/61035413/attachment-0002.bin 


More information about the users mailing list