4

I use Fedora20 and I install gtkd via sudo yum install gtkd

How to compile gtk this code ?

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

but i get this error

➜ /tmp dmd -L-lgtkd -L-ldl main.d main.d(1): Error: module MainWindow is in file 'gtk/MainWindow.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import

Please help me.

1
  • Your import path doesn't include the folder where gtkd lives. I don't know where the package puts it, but if you can find that, add -I/whatever/that/is to the compile command line (it should the gtkd folder that contains a gtk folder) and something should change. May 8, 2014 at 13:20

1 Answer 1

5

If you use gtkd-devel package provided by Fedora, you should know that it is linked against libphobos-ldc library which you will get once you install ldc2 package (yum install ldc2 will do).

This does not yet solve your problem though... gtkd-devel package installs gtkd D interface modules into the /usr/include/d/gtkd-2 folder. So, in order to compile your GtkD application you need to execute something like (assuming your D file has name "firstwin.d"): ldc2 -I/usr/include/d/gtkd-2 -L-lgtkd-2 firstwin.d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.