Screwy error
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?
November 03, 2001 10:33 AM
You set your project to a console application when you should''ve
chosen Win32 Application.
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
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 =)
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.
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.
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
Popular Topics
Advertisement