pghpma
October 21, 2008, 8:14am
1
Hi,
I have a short program that will produce random numbers using just an #include <iostream> or #include <cstdlib>.
If I also use #include <GL/glut.h> I get an error that there is a redefinition of exit.
I can either get random numbers OR be able to use exit(0) with a mouse click but I can’t seem to get both.
I am using MicroSoft C++ 2005 with OpenGL.
pghpma
October 21, 2008, 9:30am
3
rand() is not included in cmath
fyi, rand() is in <cstdlib>, and you need to include glut after any header that declares or includes exit (e.g. stdlib). There’s a commented section in glut.h that explains the details if you’re interested…
pghpma
October 21, 2008, 10:53am
5
Eureka!
Yes, now I am getting random numbers (or better yet randomly colored dots) and can still exit from the menu.
Thanks!
system
Closed
October 19, 2021, 6:24pm
6
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.