system
1
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?
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:
[b]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?[/b]
#pragma comment (lib, “glut.lib”)
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