Skip to content

Installing on Windows

RUSshy edited this page Feb 27, 2021 · 25 revisions

Building library

  1. Download newest GTK+ runtime installer and GtkD source from gtkd.org

  2. 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 "uninstall" of GtkD, being necessary 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\generated\gtkd to dmddir\src\gtkd

  5. Copy gtkd.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, 32bit:

     dmd hello.d -L+gtkd.lib
    

    or 64bit:

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