I am a newb to opengl and having problems. I have included glut32.lib glu32.lib opengl32.lib glaux.lib and libglut32.a in the Object/Library Modules for the linker
but i still get errors when i compiled anything containg opengl.
Example:
#include <GL/glut.h>
#include <stdlib.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glLoadIdentity ();
gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glScalef (1.0, 2.0, 1.0);
glutWireCube (1.0);
glFlush ();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
glMatrixMode (GL_MODELVIEW);
}
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
}
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
I get these errors
--------------------Configuration: Opengl - Win32 Debug--------------------
Linking…
Cube.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12
Cube.obj : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit@8
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Opengl.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Opengl.exe - 4 error(s), 0 warning(s)
Whats wrong? thanks for your time