Jump to content

  • Log In with Google      Sign In   
  • Create Account

GLFW3 Linker Errors


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 PandaDragonThing   Members   -  Reputation: 311

Like
0Likes
Like

Posted 03 September 2013 - 09:00 AM

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.


Edited by PandaDragonThing, 05 September 2013 - 01:58 AM.


Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4131

Like
1Likes
Like

Posted 04 September 2013 - 04:33 AM

Is it possible you are not linking to Gdi32.lib?

#3 PandaDragonThing   Members   -  Reputation: 311

Like
0Likes
Like

Posted 05 September 2013 - 01:54 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS