Followers 0

## 2 posts in this topic

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:

#define GLEW_STATIC

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



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

lib\mingw\libglfw3.a
lib\glew32s.lib
lib\libSOIL.a
opengl3

[Solution]

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

libglfw3.a
gdi32
opengl32


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

0

##### Share on other sites
Is it possible you are not linking to Gdi32.lib?
1

##### 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.

libglfw3.a
glew32s.a
libSOIL.a
gdi32
opengl32


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

0

## Create an account

Register a new account