Installing on Windows

Luis edited this page Mar 3, 2016 · 20 revisions

Building library

  1. Download newest GTK+ runtime installer from here

  2. Download GtkD sources from here

  3. Run the Build.d file with rdmd. rdmd Build.d (Build it with the -m64 flag if you want to build a 64 bits GtkD version. rdmd -m64 Build.d)

Installing library

Note: Upgrading DMD on Windows results on a "unistall" of GtkD, being necesary to repeat this steps.

  1. Open directory where dmd.exe is installed, for example C:\D\windows\bin\

  2. Open sc.ini in your editor

  3. Find DFLAGS key under the [Environment] section, and add at end of the line:

     "-I%@P%\..\..\src\gtkd"
    
  4. Copy GtkDExtractionDir\src to dmddir\src\gtkd

  5. Copy gtkd.lib, gtkdgl.lib and gtkdsv.lib to dmddir\windows\lib (if you build it with -m64, then put it on dmddir\windows\lib64)

Testing Installation

  1. Create a new blank file named hello.d.

  2. Copy the source code into it.

     import gtk.MainWindow;
     import gtk.Label;
     import gtk.Main;
     
     void main(string[] args)
     {
         Main.init(args);
         MainWindow win = new MainWindow("Hello World");
         win.setDefaultSize(200, 100);
         win.add(new Label("Hello World"));
         win.showAll();
         Main.run();
     }
    
  3. Compile and link

     dmd hello.d -L+gtkd.lib
    

or

    dmd hello.d -Lgtkd.lib -m64
  1. If it built successfully, it shouldn't print any output. You can now run hello.exe to see the program.