GLFW Compile error

anonymous wrote on Sunday, March 04, 2012:

When I try to compile GLFW using the “mingw32-make win32-mingw” command, I get
the following error:

process_begin: CreateProcess(C:\cygwin\bin\gcc.exe, gcc -I../include -Wall -O2 -mwindows accuracy.c ../lib/win32/libglfw.a -lglu32 -lopengl32 -o accuracy.exe, ...) failed.
make (e=5): Access is denied.
mingw32-make[1]: *** [accuracy.exe] Error 5
mingw32-make[1]: Leaving directory 'C:/Users/avi/Downloads/glfw-2.7.3/glfw-2.7.3/tests'

What is this error and how do I fix it?

elmindreda wrote on Sunday, March 04, 2012:

Which version of GLFW are you using, and are you using Cygwin’s MinGW or the
standalone MinGW?

elmindreda wrote on Sunday, March 04, 2012:

Sorry, the GLFW version was right there in your quote.

If you’re using Cygwin then you should be using the procedure in section 2.1.4
of the readme instead of the win32-mingw target.

anonymous wrote on Monday, March 05, 2012:

I ended up finding the precompiled library and just used that. But now I’m
getting linker errors when using GLFW and I have no idea what they’re about.
I’m making sure to link to opengl32 and glu32

The _entire_ code of my program is as follows:

#include <iostream>
#include <GL/glfw.h>
int main(int argc, char **argv)
{
	glfwInit();
	return 0;
}

And I’m getting the following errors:

c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(window.o):window.c:(.text+0x8ae): undefined reference to `glClear@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xe54): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xe6c): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xef6): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xf4f): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xf7f): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x174c): undefined reference to `wglMakeCurrent@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1935): undefined reference to `wglCreateContext@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x19fe): undefined reference to `wglMakeCurrent@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1a0e): undefined reference to `wglDeleteContext@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ea6): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ebc): undefined reference to `glGetFloatv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ed8): undefined reference to `glClearColor@16'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ee7): undefined reference to `glClear@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1f1a): undefined reference to `glClearColor@16'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(glext.o):glext.c:(.text+0x1a): undefined reference to `glGetString@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(glext.o):glext.c:(.text+0x1bf): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(glext.o):glext.c:(.text+0x1ef): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(glext.o):glext.c:(.text+0x28b): undefined reference to `glGetString@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(glext.o):glext.c:(.text+0x2cf): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libglfw.a(win32_glext.o):win32_glext.c:(.text+0x7d): undefined reference to `wglGetProcAddress@4'

Why might I be getting those errors? I’m linking to glfw and I have libglfw
installed under C:\MinGW\lib

anonymous wrote on Monday, March 05, 2012:

Okay, it works if I use the DLL. I’m good now.

elmindreda wrote on Monday, March 05, 2012:

When using the static library you need to link against the necessary libraries
yourself. See readme.html section 4.2.1 for details.