Skip to content

Hello World Example on Windows 10

Feldwor edited this page May 13, 2020 · 2 revisions
  1. Install Digital Mars D Compiler (DMD)
    https://dlang.org/download.html
  2. Install Gtk+ Runtime https://gtkd.org/download.html
  3. Create a new text-file on the Desktop named HelloWorld.d (replace .txt extension with .d)
     #!/usr/bin/env dub
     /+ dub.sdl:
     	name "HelloWorld"
     	dependency "gtk-d" version="*"
     +/
     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();
     }
    
  4. Open Command Prompt and Paste in:
    dub run --single --arch=x86 --build=plain --force HelloWorld.d
    
  5. After 20-30 seconds (Might take few minutes for slower hardware) you should see the example opened on your screen.