Jump to content
  • Advertisement
Sign in to follow this  

GLFW3 Linker Errors

This topic is 2146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am attempting to upgrade from GLFW2 to GLFW3, but I am getting these linker errors

lib\mingw\libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x30a): undefined reference to `_imp__CreateDCW@16'
lib\mingw\libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x356): undefined reference to `_imp__GetDeviceCaps@8'
lib\mingw\libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x3a2): undefined reference to `_imp__DeleteDC@4'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x7b): undefined reference to `_imp__CreateDCW@16'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x91): undefined reference to `_imp__GetDeviceGammaRamp@8'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x9d): undefined reference to `_imp__DeleteDC@4'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x35b): undefined reference to `_imp__CreateDCW@16'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x36d): undefined reference to `_imp__SetDeviceGammaRamp@8'
lib\mingw\libglfw3.a(win32_gamma.c.obj):win32_gamma.c:(.text+0x379): undefined reference to `_imp__DeleteDC@4'
lib\mingw\libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x13b): undefined reference to `_imp__DescribePixelFormat@16'
lib\mingw\libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x989): undefined reference to `_imp__DescribePixelFormat@16'
lib\mingw\libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xac2): undefined reference to `_imp__DescribePixelFormat@16'
lib\mingw\libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xae4): undefined reference to `_imp__SetPixelFormat@12'
lib\mingw\libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1592): undefined reference to `_imp__SwapBuffers@4'

I've made the changes in the code to support GLFW3( or atleast everything that compiling was complaining about earlier ). It's version 3.0.2, the latest one.

I am using Code::Blocks and mingw, the header and library file, libglfw3.a and glfw3.h, from the binary build for 32 bit Windows.

Here is how I am including:


#include "GL/glew.h"
#include "GL/glfw3.h"

And finally, here is the order and libraries I am linking to:



If you are trying to link the static version of the library, libglfw3.a, you have to link gdi32 in this order.


If you are linking in the dynamic link version of the library, glfw3dll.a, you shouldn't need to link gdi32.

Edited by PandaDragonThing

Share this post

Link to post
Share on other sites

I tried linking to gdi32 originally, but it didn't work. I tried again and fiddled with the order in which I link and it works. Yay.

If anyone is having trouble linking to the static version of GLFW3, here's the order that worked for me.


I'll put the solution in the main thread and mark it solved for anyone else encountering these problems.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!