What am I doing wrong here?

Okay, I don’t know if this is because I don’t have something installed or don’t have it installed correctly or something, but I’m getting a whole lot of errors. I just installed OpenGL to play with and tried to install glut. Maybe I did it wrong. I don’t know. Anyways where I’m getting the errors is when I try to compile an example program I found somewhere. It includes glut.h and finds it fine, but after that it brings up a list of like 30 undefined references. I’m pretty sure it’s because I either don’t have something or it’s in the wrong place. My compiler is bloodshed.net’s Dev-C++ 4. Here’s the example program.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>

GLenum doubleBuffer;
GLint thing1, thing2;

static void Init(void)
{

glClearColor(0.0, 0.0, 0.0, 0.0);
glClearAccum(0.0, 0.0, 0.0, 0.0);

thing1 = glGenLists(1);
glNewList(thing1, GL_COMPILE);
glColor3f(1.0, 0.0, 0.0);
glRectf(-1.0, -1.0, 1.0, 0.0);
glEndList();

thing2 = glGenLists(1);
glNewList(thing2, GL_COMPILE);
glColor3f(0.0, 1.0, 0.0);
glRectf(0.0, -1.0, 1.0, 1.0);
glEndList();

}

static void Reshape(int width, int height)
{

glViewport(0, 0, width, height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

}

static void Key(unsigned char key, int x, int y)
{

switch (key) {
  case '1':

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glutPostRedisplay();
break;
case ‘2’:
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glutPostRedisplay();
break;
case 27:
exit(0);
}
}

static void Draw(void)
{

glPushMatrix();

glScalef(0.8, 0.8, 1.0);

glClear(GL_COLOR_BUFFER_BIT);
glCallList(thing1);
glAccum(GL_LOAD, 0.5);

glClear(GL_COLOR_BUFFER_BIT);
glCallList(thing2);
glAccum(GL_ACCUM, 0.5);

glAccum(GL_RETURN, 1.0);

glPopMatrix();

if (doubleBuffer) {

glutSwapBuffers();
} else {
glFlush();
}
}

static void Args(int argc, char **argv)
{
GLint i;

doubleBuffer = GL_FALSE;

for (i = 1; i < argc; i++) {

if (strcmp(argv[i], “-sb”) == 0) {
doubleBuffer = GL_FALSE;
} else if (strcmp(argv[i], “-db”) == 0) {
doubleBuffer = GL_TRUE;
}
}
}

int main(int argc, char **argv)
{
GLenum type;

glutInit(&argc, argv);
Args(argc, argv);

type = GLUT_RGB | GLUT_ACCUM;
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
glutInitDisplayMode(type);
glutInitWindowSize(300, 300);
glutCreateWindow("Accum Test");

Init();

glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
glutMainLoop();

}

and here’s the error’s I’m getting.

c:\windows\TEMP\ccHohbgb.o: In function Init': //c/dev-c_~1/examples/opengl/accum.c:14: undefined reference to imp__glClearColor’
//c/dev-c
~1/examples/opengl/accum.c:15: undefined reference to _imp__glClearAccum' //c/dev-c_~1/examples/opengl/accum.c:17: undefined reference to imp__glGenLists’
//c/dev-c
~1/examples/opengl/accum.c:18: undefined reference to _imp__glNewList' //c/dev-c_~1/examples/opengl/accum.c:19: undefined reference to imp__glColor3f’
//c/dev-c
~1/examples/opengl/accum.c:20: undefined reference to _imp__glRectf' //c/dev-c_~1/examples/opengl/accum.c:21: undefined reference to imp__glEndList’
//c/dev-c
~1/examples/opengl/accum.c:23: undefined reference to _imp__glGenLists' //c/dev-c_~1/examples/opengl/accum.c:24: undefined reference to imp__glNewList’
//c/dev-c
~1/examples/opengl/accum.c:25: undefined reference to _imp__glColor3f' //c/dev-c_~1/examples/opengl/accum.c:26: undefined reference to imp__glRectf’
//c/dev-c
~1/examples/opengl/accum.c:27: undefined reference to _imp__glEndList' c:\windows\TEMP\ccHohbgb.o: In function main’:
//c/dev-c_~1/examples/opengl/accum.c:103: undefined reference to glutInit' //c/dev-c_~1/examples/opengl/accum.c:108: undefined reference to glutInitDisplayMode’
//c/dev-c_~1/examples/opengl/accum.c:109: undefined reference to glutInitWindowSize' //c/dev-c_~1/examples/opengl/accum.c:110: undefined reference to glutCreateWindow’
//c/dev-c_~1/examples/opengl/accum.c:114: undefined reference to glutReshapeFunc' //c/dev-c_~1/examples/opengl/accum.c:115: undefined reference to glutKeyboardFunc’
//c/dev-c_~1/examples/opengl/accum.c:116: undefined reference to glutDisplayFunc' //c/dev-c_~1/examples/opengl/accum.c:117: undefined reference to glutMainLoop’
c:\windows\TEMP\ccHohbgb.o: In function Reshape': //c/dev-c_~1/examples/opengl/accum.c:33: undefined reference to imp__glViewport’
//c/dev-c
~1/examples/opengl/accum.c:35: undefined reference to _imp__glMatrixMode' //c/dev-c_~1/examples/opengl/accum.c:36: undefined reference to imp__glLoadIdentity’
//c/dev-c
~1/examples/opengl/accum.c:37: undefined reference to _imp__glMatrixMode' //c/dev-c_~1/examples/opengl/accum.c:38: undefined reference to imp__glLoadIdentity’
c:\windows\TEMP\ccHohbgb.o: In function Key': //c/dev-c_~1/examples/opengl/accum.c:50: undefined reference to imp__glPolygonMode’
//c/dev-c
~1/examples/opengl/accum.c:51: undefined reference to glutPostRedisplay' c:\windows\TEMP\ccHohbgb.o: In function Draw’:
//c/dev-c
~1/examples/opengl/accum.c:61: undefined reference to _imp__glPushMatrix' //c/dev-c_~1/examples/opengl/accum.c:63: undefined reference to imp__glScalef’
//c/dev-c
~1/examples/opengl/accum.c:65: undefined reference to _imp__glClear' //c/dev-c_~1/examples/opengl/accum.c:66: undefined reference to imp__glCallList’
//c/dev-c
~1/examples/opengl/accum.c:67: undefined reference to _imp__glAccum' //c/dev-c_~1/examples/opengl/accum.c:69: undefined reference to imp__glClear’
//c/dev-c
~1/examples/opengl/accum.c:70: undefined reference to _imp__glCallList' //c/dev-c_~1/examples/opengl/accum.c:71: undefined reference to imp__glAccum’
//c/dev-c
~1/examples/opengl/accum.c:73: undefined reference to _imp__glAccum' //c/dev-c_~1/examples/opengl/accum.c:75: undefined reference to imp__glPopMatrix’
//c/dev-c
~1/examples/opengl/accum.c:78: undefined reference to glutSwapBuffers' //c/dev-c_~1/examples/opengl/accum.c:80: undefined reference to _imp__glFlush’

Please tell me you can tell me what’s going on here. Thanx.

undefined references occur when you link your program to your exe file, but the functions you use can’t be located. You didn’t tell VC what libraries your are using. This stuff is off my head, can be wrong, but you’ll get the idea:

press atl+F7 to get the program properties. press the link tab, and add the following libs to the long line of libs:

opengl32.lib glut32.lib glu32.lib

glut32.lib can be glut.lib, not sure.

John

I think John is right but if you arent using ms vc++ you need to find out how to link libraries. (the ones john mentioned).

Also make sure that you have glut.h gl.h and glu32.h (I think they are called that) in your ‘headers/gl’ folder and the glut/opengl dll’s in your system folder and finally the libraries mentioned above in your libraries folder.

Good Luck

David

Okay, I’ve got past the compiler. I had the .lib’s in my header folder. Now the linker is giving me a headache. Here’s what I’m getting now.

c:/my documents/accum.o: In function Init': //c/dev-c++/examples/opengl/accum.c:14: undefined reference to _imp__glClearColor’
//c/dev-c++/examples/opengl/accum.c:15: undefined reference to _imp__glClearAccum' //c/dev-c++/examples/opengl/accum.c:17: undefined reference to _imp__glGenLists’
//c/dev-c++/examples/opengl/accum.c:18: undefined reference to _imp__glNewList' //c/dev-c++/examples/opengl/accum.c:19: undefined reference to _imp__glColor3f’
//c/dev-c++/examples/opengl/accum.c:20: undefined reference to _imp__glRectf' //c/dev-c++/examples/opengl/accum.c:21: undefined reference to _imp__glEndList’
//c/dev-c++/examples/opengl/accum.c:23: undefined reference to _imp__glGenLists' //c/dev-c++/examples/opengl/accum.c:24: undefined reference to _imp__glNewList’
//c/dev-c++/examples/opengl/accum.c:25: undefined reference to _imp__glColor3f' //c/dev-c++/examples/opengl/accum.c:26: undefined reference to _imp__glRectf’
//c/dev-c++/examples/opengl/accum.c:27: undefined reference to _imp__glEndList' c:/my documents/accum.o: In function main’:
//c/dev-c++/examples/opengl/accum.c:103: undefined reference to glutInit' //c/dev-c++/examples/opengl/accum.c:108: undefined reference to glutInitDisplayMode’
//c/dev-c++/examples/opengl/accum.c:109: undefined reference to glutInitWindowSize' //c/dev-c++/examples/opengl/accum.c:110: undefined reference to glutCreateWindow’
//c/dev-c++/examples/opengl/accum.c:114: undefined reference to glutReshapeFunc' //c/dev-c++/examples/opengl/accum.c:115: undefined reference to glutKeyboardFunc’
//c/dev-c++/examples/opengl/accum.c:116: undefined reference to glutDisplayFunc' //c/dev-c++/examples/opengl/accum.c:117: undefined reference to glutMainLoop’
c:/my documents/accum.o: In function Reshape': //c/dev-c++/examples/opengl/accum.c:33: undefined reference to _imp__glViewport’
//c/dev-c++/examples/opengl/accum.c:35: undefined reference to _imp__glMatrixMode' //c/dev-c++/examples/opengl/accum.c:36: undefined reference to _imp__glLoadIdentity’
//c/dev-c++/examples/opengl/accum.c:37: undefined reference to _imp__glMatrixMode' //c/dev-c++/examples/opengl/accum.c:38: undefined reference to _imp__glLoadIdentity’
c:/my documents/accum.o: In function Key': //c/dev-c++/examples/opengl/accum.c:50: undefined reference to _imp__glPolygonMode’
//c/dev-c++/examples/opengl/accum.c:51: undefined reference to glutPostRedisplay' c:/my documents/accum.o: In function Draw’:
//c/dev-c++/examples/opengl/accum.c:61: undefined reference to _imp__glPushMatrix' //c/dev-c++/examples/opengl/accum.c:63: undefined reference to _imp__glScalef’
//c/dev-c++/examples/opengl/accum.c:65: undefined reference to _imp__glClear' //c/dev-c++/examples/opengl/accum.c:66: undefined reference to _imp__glCallList’
//c/dev-c++/examples/opengl/accum.c:67: undefined reference to _imp__glAccum' //c/dev-c++/examples/opengl/accum.c:69: undefined reference to _imp__glClear’
//c/dev-c++/examples/opengl/accum.c:70: undefined reference to _imp__glCallList' //c/dev-c++/examples/opengl/accum.c:71: undefined reference to _imp__glAccum’
//c/dev-c++/examples/opengl/accum.c:73: undefined reference to _imp__glAccum' //c/dev-c++/examples/opengl/accum.c:75: undefined reference to _imp__glPopMatrix’
//c/dev-c++/examples/opengl/accum.c:78: undefined reference to glutSwapBuffers' //c/dev-c++/examples/opengl/accum.c:80: undefined reference to _imp__glFlush’

I’ve noticed it’s pretty much the same errors just a different heading. It says in function something accum.o now instead ccHolgshjd.o or something like that.

I dont think you can use that compiler. I asked yesterday about alternative compilers. And they said I could use any win Compiler. anyways the copiler your using “mingw” I think can only make console programs. I am not a OpenGL expert but I think you cant make openGL programs in a console, let me know If I am wrong.

[This message has been edited by Amp (edited 09-15-2000).]

No, I’m pretty sure you can. I checked on their website and they’ve even got links to special files that have a setup program made just to install OpenGL on their compiler. I wouldn’t have had a problem if GLUT had been part of that, but I had to go get that somewhere else.

You said you’ve put the libs in your header directory; that isn’t enough, or even right.

You need te tell your compiler that you want to link them in. And they shouldn’t be in your header directory. They should be in something like *compiler*\Win32_SDK\libs.

Yeah, I just managed to figure that part out. I told the compiler what .lib’s to include and now it’s saying linker input files unused since linking not done.
Then it gives me that same list of errors.

Everyone is right about your problem but they haven’t used bloodshed C before by what I can read. I use it and find it a great alternative to VC (it’s free).

I had the same problem when I started ogl. If you want it to link add the following lines to your

Project|Project Options| dialog box in the Object files textbox:

-lopengl32 -lglu32 -lglut32

You may have figured this out but by itself it won’t work you have to change the name of the .lib files to the following

opengl32.lib to libopengl32.a
glu32.lib to libglu32.a
glut32.lib to libglut32.a

this should now work, if it doesn’t post another message with the error.

by the way use glut32.lib not glut.lib, it’s the newer version.

I think I’m on the right track now. I did what you said and it didn’t change anything, so I decided to mess around. I saw in some other code that they included gl.h glu.h glaux.h in some so I figured I’d give that a try. That gave me a whole new set of problems so I started searching around the net. Then I found somewhere (I think it might even be another post here) that said to include windows.h before the gl.h, so I did that. Now I’ve got some interesting stuff going on. Here are the new errors.

C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .text' C:\DEV-C_~1\BIN\ld.exe: C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll): warning: ignoring duplicate section .idata$5’
C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll)(.idata$2+0x0): multiple definition of idata$2' C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll)(.debug$S+0x0): first defined here C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll)(.idata$2+0x0): multiple definition of idata$4’
C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll)(.debug$S+0x0): first defined here
C:/DEV-C_~1/LIB/\libglut32.a(glut32.dll)(.idata$2+0x0): multiple definition of `idata$5’
C:/DEV-C_~1/LIB/\libopengl32.a(OPENGL32.dll)(.debug$S+0x0): first defined here

Looks like Klingon to me. I hope somebody else can tell me what’s going on here. Thanx for your patience.

do this:
click on Project > Add to Project> Add file project, and enter the .libs (opengl32.lib, glut32.lib, glut.lib), should work from here
I’m not sure how you included the .libs before but you might wanna try opening a new workspace.

Yep once more I am wrong. I saw a DL for the code for Mingw on NeHe’s site.

You shouldn’t have to include any of the gl.h, glu.h, windows.h because they are included in by the glut.h file although it doesn’t hurt to put them in. If you check in the examples folder that comes with bloodshed c++ you will see a win32 opengl example, try and complile that, if it doesn’t it’s might be to do with the way you installed either the opengl stuff or the compiler.

Also I had a better look at your code and although it won’t be causing your error to my knowledge you have to define a view type. i.e. glOrtho, glFrustum, gluPerspective in the reshape function.