0

I'm trying to compile a C++ opengl project inside Visual Studio but I'm getting the following errors :

Error   2   error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
Error   2   error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8
Error   4   error LNK1120: 2 unresolved externals

Does anyone know why I'm getting this error? Am I missing a library?

Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
Michael S
  • 31
  • 2
  • 3
  • From looking on Google, either linking to `glut32.lib` or using `#define GLUT_DISABLE_ATEXIT_HACK`. – chris Dec 10 '12 at 02:26
  • make sure you have you project setup as described here but replace GLFW with GLUT stuff. http://stackoverflow.com/questions/13785633/glewglfw-win32-no-dependencies-visual-studio – Michael IV Dec 10 '12 at 09:48
  • http://stackoverflow.com/questions/19401441 – Peter K Oct 16 '13 at 11:42

1 Answers1

0

GLUT is too old library. Using FreeGlut to replace GLUT. The APIs is same and you can find it by here.

In windows platform:

  • download the source code
  • select the right vs solution file and build it.
  • copy the dll file to c:\windows\system32
  • copy the lib file to VisualStudioInstalledDirectory\VC\lib or C:\Program Files\windows kit\8.*\Lib\winv6.3\um\x86
  • copy the header files to VisualStudioInstalledDirectory\VC\include\GL or C:\Program Files\windows kit\8.*\Include\um\gl

Now, after #include <GL/freeglut.h> you can use glut functions

rainyi
  • 1
  • 2