Reputation: 91
I'm trying to use glfw 2.7.8 with the Digital Mars D compiler version 2.0.
I followed the instructions from the example makefile on copying the .lib files to dm/lib folder, but I have not had success.
An example compile looks like this.
dmd main.d
The source of the file is:
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 have tried on both Windows 7 and Mac OSX 10.8.2, but I have not had success. Should I compile glfw.d as a lib and then drop it into my main directory?
I have also had _symbol not found messsages when I try to drop the .lib into the main directory and use the -L compiler flags linking to glfw.lib.
Any examples or help would be much appreciated.
Upvotes: 4
Views: 260
Reputation: 48196
you need to add -Ipath/to/glfw-x.x.x/support/d/imports
to the compiler directive
you can also add the lib folder (with the def files) with the -L switch so the linker can map the symbols properly to the ones exposed in the dll
Upvotes: 2
Reputation: 1
You need to pass glfw.d to the compiler:
dmd main.d glfw.d
assuming it is in the same directory as main.d.
Upvotes: 0