I need some help.

Well i’ve come into a bit of trouble. I’m trying to compile one of the examples found in the redbook and I get this…

2 C:\Documents and Settings\jmcp3\Desktop\Programming\General\hello.cpp In file included from C:\Documents and Settings\jmcp3\Desktop\Programming\General\hello.cpp

43 C:\Dev-Cpp\include\GL\glut.h redeclaration of C++ built-in type `short'  
C:\Documents and Settings\jmcp3\Desktop\Programming\General\hello.cpp In function `int main(int, char**)':
 44 C:\Documents and Settings\jmcp3\Desktop\Programming\General\hello.cpp `GLUT_RBG' undeclared (first use this function) 

I’m using Dev-C++ to compile the source, which is below.

#include <GL/gl.h>
#include <GL/glut.h>

void Display(void)
     /* Clear all pixles */
     /* Draw a white polygon (rectangle) with corners
     at (0.25, 0.25, 0) and (0.75, 0.75, 0)*/
     glColor3f(1.0, 1.0, 1.0);
         glVertex3f(0.25, 0.25, 0.0);
         glVertex3f(0.75, 0.25, 0.0);
         glVertex3f(0.75, 0.75, 0.0);
         glVertex3f(0.25, 0.75, 0.0);
     /* Don't wait.. Start processing buffered opengl routines */

void Init(void)
     /* set background color (Clearing color) */
     glClearColor(0.0, 0.0, 0.0, 0.0);
     /* Initialize viewing values */
     glOrtho(0.0, 1.0 , 0.0, 1.0, -1.0, 1.0);
/* Declare initial window size, position, and display mode
 * (single buffer and RGBA). Open window with "Hello" in its
 * title bar. Call initialization routines. Register callback
 * function to display graphics. Enter main loop and process
 * events.

int main(int argc, char** argv)
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RBG);
    glutInitWindowSize(250, 250);
    glutInitWindowPosition(100, 100);
    return 0;
  1. Include only “glut.h” if you are using GLUT. You may have conflicts if you inculde both glut.h and gl.h in your code. And glut.h will automatically include gl.h and glu.h for you.

  2. Use GLUT_RGB (or GLUT_RGBA) instead GLUT_RBG in your glutInitDisplayMode(). I think it is a typing error.