• Advertisement

Archived

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

random numbers! ARGH!

This topic is 6424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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
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
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
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

  • Advertisement