Archived

This topic is now archived and is closed to further replies.

Quantum

random numbers! ARGH!

Recommended Posts

Quantum    122
argh!!!!!! why cant i get: srand((unsigned)time(NULL)); to work?? im writing a simple pong clone for win32 using gdi, and i NEED random numbers!! when i try to compile i get the errors: error C2501: ''srand'' : missing storage-class or type specifiers error C2373: ''srand'' : redefinition; different type modifiers see declaration of ''srand'' plz help

Share this post


Link to post
Share on other sites
Quantum    122
yes i do!!
are there any other #include's i need to do?

edit: and is there any particular order i should have my #define's in?


Edited by - Quantum on July 22, 2000 11:03:27 PM

Share this post


Link to post
Share on other sites
zerwit    122
That does not sound like any include problem. Are you sure that you haven''t missed a semi colon before that statement, or something like that. That is a very wierd error to get for that statement.

*** Triality ***

Share this post


Link to post
Share on other sites
Quantum    122
i fixed it!!

the srand() was at the top of the file, just below the #define''s. i simply moved it to the beginning of WinMain() and it worked fine! strange...

Share this post


Link to post
Share on other sites
Serge K    154
srand() is required <stdlib.h>
I guess, you have moved it below the correct include.


Edited by - Serge K on July 23, 2000 2:45:45 AM

Share this post


Link to post
Share on other sites
Syzygy    122
If you had it just below the #defines, then that''s your problem. You have to put executable code like that within functions.

Share this post


Link to post
Share on other sites