www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Errors when compiling

reply "James" <James.Hammer gmail.com> writes:
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
Nov 02 2014
next sibling parent reply "James" <James.Hammer gmail.com> writes:
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
Nov 02 2014
next sibling parent "tcak" <tcak gmail.com> writes:
On Sunday, 2 November 2014 at 17:36:37 UTC, James wrote:
 On Sunday, 2 November 2014 at 17:33:09 UTC, James wrote:

 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
dmd -m64 main.d glfw3.d opengl32.lib glfw3.lib You use "opengl32" while compiling with "-m64". Can you test compiling without "-m64".
Nov 02 2014
prev sibling parent Mike Parker <aldacron gmail.com> writes:
On 11/3/2014 2:36 AM, James wrote:

 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
Since you're compiling with -m64, make sure you have the 64-bit GLFW binaries and not the 32-bit. Also, you won't need your own copy of opengl32.lib if you've installed the Windows SDK along with your Visual Studio toolchain. If you were to use the DerelictGLFW3 [1] & DerelictGL3 [2] bindings (preferably using DUB [3] to manage your project) then you would not have any link-time dependencies. With DUB, you don't even need to download the bindings, since it will manage it all for you. All you would need is the shared libraries (the DLLs). The Derelict bindings load the shared libraries at run time (see the README in the github repo for each project for details). You still have to make sure you're using the appropriate GLFW DLL (32-bit vs 64-bit). [1] https://github.com/DerelictOrg/DerelictGLFW3 [2] https://github.com/DerelictOrg/DerelictGL3 [3] http://code.dlang.org/download
Nov 03 2014
prev sibling parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 3/11/2014 6:33 a.m., 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
To explain further about a previous poster, on Windows 32bit dmd uses OMF format for binaries not PE-COFF. The binaries you downloaded would have been PE-COFF. For 64bit dmd uses the msvc linker as well as PE-COFF format. Second, have you looked at dub [0]. Dub is a great little build manager that can do dependency management (look at [0] for available packages). Take note of the Derelict ones, they use shared libraries so you should be able to download those pretty easily and work. [0] http://code.dlang.org
Nov 02 2014