Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

srand((unsigned)time( NULL )); wont work =/

Status
Not open for further replies.

BungoMan

Programmer
May 13, 2002
12
0
0
US
i swear ive used this before, and its worked and now it doesnt and i cant figure out why it wont work... here is all i have, just to test it...

#include <iostream>
#include <stdilb.h>
#include <time.h>

void main()
{
srand((unsigned)time( NULL ));
cout << rand() << endl << rand() << endl << rand() endl;
}

--------------------Configuration: bah - Win32 Debug--------------------
Compiling...
bah.cpp
c:\program files\microsoft visual studio\my projects\bah\bah.cpp(10) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

bah.exe - 1 error(s), 0 warning(s)


could the problem be in my time.h file? why itd be messed up is beyond me... but its not working and i KNOW it used to... grrr...
 
Perhaps the precompiled headers are broken. Delete the .pch file of your project and try again.

Also, I see that you #include <stdilb.h> instead of <stdlib.h> - perhaps this is the cause for the compiler's confusion :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top