PDA

View Full Version : link error, help



lanstar2
09-14-2004, 01:04 AM
hi,
below is a simple code sample :
*************************************
#include <GL\glut.h>
void display (void);
void main (int argc, char **argv)
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (500, 500);
glutInitWindowPosition (0,0);
glutCreateWindow ("OpenGL");
glutDisplayFunc(display);
glutMainLoop();
}
void display (void)
{
}
*************************************
and following is a link error concerning the above code sample:
**************************
Linking...
PRIM.OBJ : error LNK2001: unresolved external symbol ___glutInitWithExit@12
PRIM.OBJ : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit@8
Debug/PRIM.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
***************************
so what is the matter and solution for it?
(i am using visual c++ 6.0 compiler under winXP,
I've add glut32.dll to C:\windows/system32.The project is win32 console.
link/Project Options:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glut32.lib glaux.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/PRIM.pdb" /debug /machine:I386 /out:"Debug/PRIM.exe" /pdbtype:sept
c&c++/project Options:
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/PRIM.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
thank you..

CrazyButcher
09-14-2004, 02:05 AM
not sure but try

#define GLUT_DISABLE_ATEXIT_HACK

before you include glut.h

lanstar2
09-14-2004, 04:45 PM
Originally posted by CrazyButcher:
not sure but try

#define GLUT_DISABLE_ATEXIT_HACK

before you include glut.h:) Many thanks, it's ok.