Binding glfw and D

I am trying to use glfw 2.7.8 with the Digital Mars D compiler version 2.0.

I followed the instructions from the makefile example when copying .lib files to the dm / lib folder, but I did not succeed.

An example compilation is as follows.

dmd main.d 

File Source:

 import std.string; import glfw; int main() { glfwInit(); return 0; } 

The output I get is

 main.d(2): Error: module glfw is in file 'glfw.d' which cannot be read import path[0] = /usr/share/dmd/src/phobos import path[1] = /usr/share/dmd/src/druntime/import 

I tried on both Windows 7 and Mac OSX 10.8.2, but I did not succeed. Should I compile glfw.d as lib and then delete it in the main directory?

I also didn’t have _symbol no messsages detected when I try to remove .lib to the main directory and use the -L compiler flags that reference glfw.lib.

Any examples or help would be greatly appreciated.

+4
source share
2 answers

you need to add -Ipath/to/glfw-xxx/support/d/imports to the compiler directive

you can also add a lib folder (with def files) with the -L switch so that the linker can correctly display characters in those that were opened in the dll

+2
source

You need to pass glfw.d to the compiler:

 dmd main.d glfw.d 

provided that it is in the same directory as main.d.

0
source

All Articles