Errors when compiling

James via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 2 09:36:36 PST 2014


On Sunday, 2 November 2014 at 17:33:09 UTC, James wrote:
> Hello,
>
> I want to start using D for game development instead of C and 
> C++.
> This is my code :
>
> **********************************************************************************
>
> import std.stdio;
> import glfw3;
>
> void main()
> {
>   if(!glfwInit())
>   {
>     writeln("Could not start GLFW3");
>   }
>
>   GLFWwindow *window = glfwCreateWindow(640, 480, "Hello 
> Triangle", null, null);
>   if(!window)
>   {
>     writeln("Could not open window");
>   }
>   glfwMakeContextCurrent(window);
>
>   glfwTerminate();
> }
>
> **********************************************************************************
>
> My dir looks like this :
>
> glfw3.d ( obtained from 
> https://github.com/D-Programming-Deimos/glfw )
> glfw3.dll
> glfw3.lib
> glfw3dll.lib
> main.d
> opengl32.lib
>
>
> I'm using the DMD compiler. I run :
> dmd -m64 main.d glfw3.d opengl32.lib glfw3.lib
>
>
> Now I'm getting errors which I do not know how to fix. I'm 
> including the same libraries as I do when I write games in C++. 
> ( glfw3.lib and opengl32.lib ).
>
> Errors :
> opengl32.lib : warning LNK4003: invalid library format; library 
> ignored
> MSVCRT.lib(MSVCR120.dll) : error LNK2005: calloc already 
> defined in LIBCMT.lib(c
> alloc.obj)
> MSVCRT.lib(MSVCR120.dll) : error LNK2005: free already defined 
> in LIBCMT.lib(fre
> e.obj)
> MSVCRT.lib(MSVCR120.dll) : error LNK2005: realloc already 
> defined in LIBCMT.lib(
> realloc.obj)
> MSVCRT.lib(MSVCR120.dll) : error LNK2005: _vsnprintf already 
> defined in LIBCMT.l
> ib(vsnprint.obj)
> opengl32.lib : warning LNK4003: invalid library format; library 
> ignored
> LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use 
> of other libs; us
> e /NODEFAULTLIB:library
> opengl32.lib : warning LNK4003: invalid library format; library 
> ignored
> glfw3.lib(context.obj) : error LNK2019: unresolved external 
> symbol __imp_glGetIn
> tegerv referenced in function _glfwRefreshContextAttribs
> glfw3.lib(context.obj) : error LNK2019: unresolved external 
> symbol __imp_glGetSt
> ring referenced in function glfwExtensionSupported
> glfw3.lib(window.obj) : error LNK2019: unresolved external 
> symbol __imp_glClear
> referenced in function glfwCreateWindow
> glfw3.lib(win32_init.obj) : error LNK2019: unresolved external 
> symbol __imp_Unre
> gisterClassW referenced in function _glfwPlatformTerminate
> glfw3.lib(win32_init.obj) : error LNK2019: unresolved external 
> symbol __imp_Syst
> emParametersInfoW referenced in function _glfwPlatformInit
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_C
> reateDCW referenced in function _glfwPlatformGetMonitors
> glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external 
> symbol __imp_Cre
> ateDCW
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_D
> eleteDC referenced in function _glfwPlatformGetMonitors
> glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external 
> symbol __imp_Del
> eteDC
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_G
> etDeviceCaps referenced in function _glfwPlatformGetMonitors
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_C
> hangeDisplaySettingsExW referenced in function 
> _glfwRestoreVideoMode
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_E
> numDisplaySettingsW referenced in function 
> _glfwPlatformGetVideoMode
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_E
> numDisplaySettingsExW referenced in function 
> _glfwPlatformGetMonitorPos
> glfw3.lib(win32_monitor.obj) : error LNK2019: unresolved 
> external symbol __imp_E
> numDisplayDevicesW referenced in function 
> _glfwPlatformGetMonitors
> glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external 
> symbol __imp_Enu
> mDisplayDevicesW
> glfw3.lib(win32_gamma.obj) : error LNK2019: unresolved external 
> symbol __imp_Get
> DeviceGammaRamp referenced in function _glfwPlatformGetGammaRamp
> glfw3.lib(win32_gamma.obj) : error LNK2019: unresolved external 
> symbol __imp_Set
> DeviceGammaRamp referenced in function _glfwPlatformSetGammaRamp
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_Des
> cribePixelFormat referenced in function _glfwCreateContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_Set
> PixelFormat referenced in function _glfwCreateContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_wgl
> CreateContext referenced in function _glfwCreateContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_wgl
> DeleteContext referenced in function _glfwDestroyContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_wgl
> GetProcAddress referenced in function 
> _glfwPlatformGetProcAddress
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_wgl
> MakeCurrent referenced in function 
> _glfwPlatformMakeContextCurrent
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_wgl
> ShareLists referenced in function _glfwCreateContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_Swa
> pBuffers referenced in function _glfwPlatformSwapBuffers
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_Get
> DC referenced in function _glfwCreateContext
> glfw3.lib(wgl_context.obj) : error LNK2019: unresolved external 
> symbol __imp_Rel
> easeDC referenced in function _glfwDestroyContext
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Tr
> ackMouseEvent referenced in function windowProc
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Tr
> anslateMessage referenced in function _glfwPlatformPollEvents
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Di
> spatchMessageW referenced in function _glfwPlatformPollEvents
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Pe
> ekMessageW referenced in function _glfwPlatformPollEvents
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tMessageTime referenced in function translateKey
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Wa
> itMessage referenced in function _glfwPlatformWaitEvents
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_De
> fWindowProcW referenced in function windowProc
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Re
> gisterClassW referenced in function registerWindowClass
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Cr
> eateWindowExW referenced in function createWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_De
> stroyWindow referenced in function _glfwPlatformCreateWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Sh
> owWindow referenced in function _glfwPlatformHideWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tWindowPos referenced in function _glfwPlatformCreateWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Is
> Iconic referenced in function windowProc
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Br
> ingWindowToTop referenced in function _glfwPlatformShowWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tFocus referenced in function _glfwPlatformShowWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tKeyState referenced in function getKeyMods
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tAsyncKeyState referenced in function _glfwPlatformPollEvents
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ma
> pVirtualKeyW referenced in function translateKey
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tCapture referenced in function _glfwPlatformSetCursorMode
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Re
> leaseCapture referenced in function hideCursor
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tForegroundWindow referenced in function _glfwPlatformShowWindow
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tWindowTextW referenced in function _glfwPlatformSetWindowTitle
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tClientRect referenced in function 
> _glfwPlatformGetFramebufferSize
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ad
> justWindowRectEx referenced in function 
> _glfwPlatformSetWindowPos
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Sh
> owCursor referenced in function _glfwPlatformSetCursorMode
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tCursorPos referenced in function _glfwPlatformSetCursorPos
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tCursor referenced in function hideCursor
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tCursorPos referenced in function hideCursor
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Cl
> ipCursor referenced in function hideCursor
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Cl
> ientToScreen referenced in function _glfwPlatformGetWindowPos
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Wi
> ndowFromPoint referenced in function hideCursor
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Ge
> tWindowLongPtrW referenced in function windowProc
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Se
> tWindowLongPtrW referenced in function windowProc
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Lo
> adCursorW referenced in function registerWindowClass
> glfw3.lib(win32_window.obj) : error LNK2019: unresolved 
> external symbol __imp_Lo
> adIconW referenced in function registerWindowClass
> main.exe : fatal error LNK1120: 59 unresolved externals
> --- errorlevel 1120
>
>
> Pastebin link : http://pastebin.com/wywiB1Mp
>
>
> Thanks in advance

It's telling me that the libraries are in an invalid format. How 
can I get the correct ones ? I got those from the GLFW website


More information about the Digitalmars-d mailing list