A simple opengl question

When I install Microsoft Visual Studio 2010, it is assumed OpenGL is already installed (I am not taliking about glut.h, I am only talking about gl.h and glu.h). But while compiling one program I found that if I don’t include gl.h, it shows error.
Then I had to include the following for compilation:

#include <gl/gl.h>

But to me, the program should compile without it.

As I am new in this field, things may not be clear to me. It would be good if anyone clarifies it. Thanks.

Mine is in the Microsoft Windows SDK - I don’t think that installs with VS.

What message did your compiler give?
What makes you say you don’t need to include gl.h?

Usually when I write a openGl program in MSVC 2010, I don’t include the following header files:

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

But I downloaded one program from the website, while trying to compile it, it was looking for gl.h file. But my question is why I don’t need to include those headers in all appications.
I am new in OpenGL, so I need this clarification. Thanks

It could be that you are using another header file that themselves include gl.h and glu.h.

I have included the following file which does not include gl.h or glu.h

I have included the following file which uses neither GL.h nor GLU.h, but I can run and comiple it in my machine.

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#include <vector>
using namespace std;

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_PROJECTION); 
glLoadIdentity(); 
glOrtho(-10, 10, -10, 10, -1, 1); 

glMatrixMode(GL_MODELVIEW); 
glLoadIdentity(); 

glPushMatrix(); 
    glScalef(5,5,5); 
    glBegin(GL_QUADS); 
        glColor3ub(255,0,0); 
        glVertex2f(-1,-1); 
        glColor3ub(0,255,0); 
        glVertex2f(1,-1); 
        glColor3ub(0,0,255); 
        glVertex2f(1,1); 
        glColor3ub(255,255,255); 
        glVertex2f(-1,1); 
    glEnd(); 
glPopMatrix(); 

glutSwapBuffers(); 

}

int win_w = 0;
int win_h = 0;
void reshape(int w, int h)
{
win_w = w;
win_h = h;
glViewport(0, 0, w, h);
}

void mouse( int x, int y )
{
// 4 bytes per pixel (RGBA), 1x1 bitmap
std::vector< unsigned char > pixels( 1 * 1 * 4 );
glReadPixels( x, win_h - y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0] );

cout &lt;&lt; "r: " &lt;&lt; (int)pixels[0] &lt;&lt; endl; 
cout &lt;&lt; "g: " &lt;&lt; (int)pixels[1] &lt;&lt; endl; 
cout &lt;&lt; "b: " &lt;&lt; (int)pixels[2] &lt;&lt; endl; 
cout &lt;&lt; "a: " &lt;&lt; (int)pixels[3] &lt;&lt; endl; 
cout &lt;&lt; endl; 

}

int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);

glutInitWindowSize(800,600); 
glutCreateWindow("glReadPixels()"); 

glutDisplayFunc(display); 
glutReshapeFunc(reshape); 
glutPassiveMotionFunc(mouse); 
glutMainLoop(); 
return 0; 

}

glut.h includes gl.h and glu.h

Thank you very much for clarification.

Your question is without the least regard to opengl but a basic c/c++ one. Why not first try it in your national computer technology forum but directly submit here such an international and authoritative one?