PDA

View Full Version : Beginning OpenGL Programming



12-02-2003, 05:27 AM
I have this code:

#include <GL/glut.h>

void main(int argcp, char **argv)
{

glutInit(&argcp,argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutInitDisplayMode(GLUT_RGBA);
glutMainLoop();
}

It returns:

main.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12
Debug/main.exe : fatal error LNK1120: 1 unresolved externals

Why is that?

nexusone
12-02-2003, 06:55 AM
When you post compiler error's remember to state what compiler you are using and what version.

Try adding #include<windows.h> before glut.h.


Originally posted by Spyros:
I have this code:

#include <GL/glut.h>

void main(int argcp, char **argv)
{

glutInit(&argcp,argv);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutInitDisplayMode(GLUT_RGBA);
glutMainLoop();
}

It returns:

main.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12
Debug/main.exe : fatal error LNK1120: 1 unresolved externals

Why is that?

chowe6685
12-02-2003, 07:13 AM
#pragma comment (lib, "glut.lib")

Deiussum
12-02-2003, 10:55 AM
Actually, that looks like the infamous glut exit hack needed for some versions of glut on some compilers. Before #include <GL/glut.h> add

#define GLUT_DISABLE_ATEXIT_HACK