Original Post
After spending the last four hours trying to get this working, I'm resorting to asking for help. I've installed MinGW on my XP64 machine, along with GLUT. I've put glut.h in C:\MinGW\include\GL, libglut32.a in C:\MinGW\lib and glut32.dll in C:\WINDOWS\system32. When I try to run a sample program, I get the following: Here's my code, which I'm assuming works since I got it from a tutorial. Thanks in advanced.
g++ helloGL.cpp -lopengl32 -lglu32 -lglut32
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x1c): undefined reference to `__glutInitWithExit'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x37): undefined reference to `__glutCreateWindowWithExit'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x53): undefined reference to `__glutCreateMenuWithExit'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x7e): undefined reference to `_imp__glViewport'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x8c): undefined reference to `_imp__glMatrixMode'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x93): undefined reference to `_imp__glLoadIdentity'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0xc9): undefined reference to `_imp__glOrtho'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0xd7): undefined reference to `_imp__glMatrixMode'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0xee): undefined reference to `_imp__glClear'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0xf5): undefined reference to `_imp__glLoadIdentity'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0xfc): undefined reference to `glutSwapBuffers'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x12c): undefined reference to `_imp__glClearColor'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x13a): undefined reference to `_imp__glEnable'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x186): undefined reference to `glutInitDisplayMode'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x19a): undefined reference to `glutInitWindowSize'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x1b2): undefined reference to `glutDisplayFunc'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x1be): undefined reference to `glutReshapeFunc'
C:\.../ccY1lEyc.o:helloGL.cpp:(.text+0x1c8): undefined reference to `glutMainLoop'
collect2: ld returned 1 exit status
#include <stdlib.h>
#include <GL/glut.h>
void keyboard(unsigned char key, int x, int y);
void display(void);
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutCreateWindow("GLUT Test");
glutKeyboardFunc(&keyboard);
glutDisplayFunc(&display);
glutMainLoop();
return EXIT_SUCCESS;
}
void keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case '\x1B':
exit(EXIT_SUCCESS);
break;
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_POLYGON);
glVertex2f(-0.5f, -0.5f);
glVertex2f( 0.5f, -0.5f);
glVertex2f( 0.5f, 0.5f);
glVertex2f(-0.5f, 0.5f);
glEnd();
glFlush();
}