linuxdgtkd

How to use gtkd on linux


I am trying to compile a hello world program using the gtkd library.
I am using the dmd compiler (installed into my ~/ directory) and I have already checked that the compiler works flawlessly.
Just in case, here is my source code:

//pragma(lib, "gtkd");
//pragma(lib, "dl");

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();
}

The pragmas are commented out, because (if I understand this correctly) they do nothing more than the -L-l flags, nor did they get me any closer to a solution. Anyways, after I save the file, I run:

dmd hello.d -L-lgtkd -L-ldl

and get the following error:

/usr/bin/ld: cannot find -lgtkd
collect2: error: ld returned 1 exit status
--- errorlevel 1

I already copied libgtkd-3.a, libgtkdgl-3.a and libgtkdsv-3.a into /usr/lib, but the output of the terminal remained the same. I understand that the linker can't find my files, but I don't know how else I can help him do so.

For further info on my installation, I have set up everything exactly as in this post. Not sure if it matters, but my computer is running crunchbang, a distro based on debian wheezy. Thanks in advance, R


Solution

  • dmd hello.d -L-lgtkd -L-ldl
    

    this try to find libgtkd.a but you does not have libgtkd.a, you have libgtkd-3.a so you must use:

    dmd hello.d -L-lgtkd-3 -L-ldl