Advertisement

random numbers! ARGH!

Started by July 22, 2000 09:40 PM
5 comments, last by Quantum 24 years, 5 months ago
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
Do you have this:

    #include <time.h>    
Need help? Well, go FAQ yourself. "Just don't look at the hole." -- Unspoken_Magi
Advertisement
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
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 ***
*** Triality ***
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...
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
Advertisement
If you had it just below the #defines, then that''s your problem. You have to put executable code like that within functions.

This topic is closed to new replies.

Advertisement