Archives

All posts for the month November, 2014

If you’re wondering why your project is desperately seeking “freeglut.lib”, instead of “freeglut_static.lib”, resulting in a linker error. Or a host of 2019 (unresolved external symbol) linker errors, if you try to rename freeglut_static, to freeglut, then your “problem” lies in the freeglut_std.h header file, that’s included in your project.

If you look at that file, you’ll see the following preprocessor conditional:

/* Windows static library */
# ifdef FREEGLUT_STATIC

# define FGAPI
# define FGAPIENTRY

/* Link with Win32 static freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut_static.lib")
# endif

/* Windows shared library (DLL) */
# else

# define FGAPIENTRY __stdcall
# if defined(FREEGLUT_EXPORTS)
# define FGAPI __declspec(dllexport)
# else
# define FGAPI __declspec(dllimport)

/* Link with Win32 shared freeglut lib */
# if FREEGLUT_LIB_PRAGMAS
# pragma comment (lib, "freeglut.lib")
# endif

# endif

# endif

So to use the static library, you’ll need to add FREEGLUT_STATIC to your preprocessor commands.

If you happen to be using GLEW, that also requires a preprocessor command before it will use the static library. In that case, it’s GLEW_STATIC.