GtkD with D lang on Fedora

风格不统一 提交于 2019-12-12 11:35:24

问题


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:


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



来源:https://stackoverflow.com/questions/23542478/gtkd-with-d-lang-on-fedora

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!