🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Screwy error

Started by
4 comments, last by Sinner_Zero 22 years, 7 months ago
I''m getting a wierd error here when compiling some code that should work, I got it from a tutorial and am testing my compiler, I''m using MVC++ 5. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main that''s the error, this just uses some Windows GDI stuff, I have no clue where this error could be coming from. Anyone got any ideas?
Advertisement
You set your project to a console application when you should''ve
chosen Win32 Application.
damnit, I went with default project, DAMN YOU M$!

hehe.

Thnx though, cuz now I know I was right when I chose Win32 before =D
Cool, works like a charm.

Can anyone explain rand() and srand() to me quickly, more to the extent of what srand() does, I''ve never used the random number generator yet, would be really helpful please =)
rand() calculates a pseudo-random number from the current seed value. srand() sets the seed value. If you for example srand(5) and then call rand() a few times, and then call srand(5) again and call rand() a few times again, then the first and second sequence of ''random'' numbers will always be the same because they are based on the same seed. A common practise is therefore to call srand with the current system time or some other value that won''t (likely) be the same each time you run the program (assuming you don''t want the number sequence to be the same each time).

IIRC there should be an option to install the C runtime source code when you install MSVC++. Look at the source for rand() to see the algorithm used.

There are usually better ways than rand() to get random numbers though (depending on how rand() is implemented). The Mersenne Twister should be pretty good.
Cool, I knew there was no such thing as a real random number generator.....or did I.

Actually, thnx a lot there.

But is there any real random number generator, and I don''t mean for C/C++, I mean is there one in existance somewhere.

And this MT thing seems nice. I think I might be using it.

This topic is closed to new replies.

Advertisement