NO

Author Topic: Cannot use GLFW library  (Read 5263 times)

player55

  • Guest
Cannot use GLFW library
« on: June 13, 2013, 04:51:39 PM »
I'm trying to get the GLFW library to work with Pelles C. I downloaded the precompiled Visual Studio binaries and included all the right libraries. First, POLINK told me it can't find 'msvcrt.lib', so I copied it from the Visual Studio lib folder into my own. Then I got this error:

Code: [Select]
POLINK: error: Symbol 'free' is multiply defined: 'crt64.lib(free.obj)' and 'msvcrt.lib(MSVCR110.dll)'.
POLINK: error: Symbol 'malloc' is multiply defined: 'crt64.lib(malloc.obj)' and 'msvcrt.lib(MSVCR110.dll)'.

I then turned on "Omit default library name in object files" to remove the conflict. However, I then got another list of errors:

Code: [Select]
POLINK: error: Unresolved external symbol '__stderr'.
POLINK: error: Unresolved external symbol '__negmaskf'.
POLINK: fatal error: 2 unresolved external(s).

Any suggestions?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Cannot use GLFW library
« Reply #1 on: June 13, 2013, 06:07:36 PM »
  • use mingw version of dll's
  • create import library for that with polib.exe
Code: [Select]
;glfw3dll.def
LIBRARY glfw3.dll
EXPORTS
"glfwCreateWindow"
"glfwDefaultWindowHints"
"glfwDestroyWindow"
"glfwExtensionSupported"
"glfwGetClipboardString"
"glfwGetCurrentContext"
"glfwGetCursorPos"
"glfwGetFramebufferSize"
"glfwGetGammaRamp"
"glfwGetInputMode"
"glfwGetJoystickAxes"
"glfwGetJoystickButtons"
"glfwGetJoystickName"
"glfwGetKey"
"glfwGetMonitorName"
"glfwGetMonitorPhysicalSize"
"glfwGetMonitorPos"
"glfwGetMonitors"
"glfwGetMouseButton"
"glfwGetPrimaryMonitor"
"glfwGetProcAddress"
"glfwGetTime"
"glfwGetVersion"
"glfwGetVersionString"
"glfwGetVideoMode"
"glfwGetVideoModes"
"glfwGetWGLContext"
"glfwGetWin32Window"
"glfwGetWindowAttrib"
"glfwGetWindowMonitor"
"glfwGetWindowPos"
"glfwGetWindowSize"
"glfwGetWindowUserPointer"
"glfwHideWindow"
"glfwIconifyWindow"
"glfwInit"
"glfwJoystickPresent"
"glfwMakeContextCurrent"
"glfwPollEvents"
"glfwRestoreWindow"
"glfwSetCharCallback"
"glfwSetClipboardString"
"glfwSetCursorEnterCallback"
"glfwSetCursorPos"
"glfwSetCursorPosCallback"
"glfwSetErrorCallback"
"glfwSetFramebufferSizeCallback"
"glfwSetGamma"
"glfwSetGammaRamp"
"glfwSetInputMode"
"glfwSetKeyCallback"
"glfwSetMonitorCallback"
"glfwSetMouseButtonCallback"
"glfwSetScrollCallback"
"glfwSetTime"
"glfwSetWindowCloseCallback"
"glfwSetWindowFocusCallback"
"glfwSetWindowIconifyCallback"
"glfwSetWindowPos"
"glfwSetWindowPosCallback"
"glfwSetWindowRefreshCallback"
"glfwSetWindowShouldClose"
"glfwSetWindowSize"
"glfwSetWindowSizeCallback"
"glfwSetWindowTitle"
"glfwSetWindowUserPointer"
"glfwShowWindow"
"glfwSwapBuffers"
"glfwSwapInterval"
"glfwTerminate"
"glfwWaitEvents"
"glfwWindowHint"
"glfwWindowShouldClose"
EDIT:
Code: [Select]
polib.exe /DEF:glfw3dll.def /OUT:glfw3dll.lib /MACHINE:AMD64
« Last Edit: June 13, 2013, 07:44:33 PM by timovjl »
May the source be with you

player55

  • Guest
Re: Cannot use GLFW library
« Reply #2 on: June 13, 2013, 07:33:37 PM »
Got it to work using:

Code: [Select]
polib /def:glfw3.def glfw3.lib /machine:amd64
Did you use dumpbin to create that .def file?

The resulting lib is surprisingly smaller than the VS one. Any idea why that is?

Thanks
« Last Edit: June 13, 2013, 07:56:38 PM by player55 »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Cannot use GLFW library
« Reply #3 on: June 13, 2013, 08:13:34 PM »
May the source be with you

player55

  • Guest
Re: Cannot use GLFW library
« Reply #4 on: June 13, 2013, 08:40:40 PM »
Ah, that's a helpful add-in, thanks.

I wanted a truly static library though and I managed to build GLFW 3.0 in Pelles C for anyone who needs it (attached).
« Last Edit: June 13, 2013, 09:11:06 PM by player55 »