dfedoragtkd

What is required to compile a simple gtk D application


I'm just getting started in D and am following the examples on dsource.org

Specifically this one: http://www.dsource.org/projects/gtkd/wiki/CodeExamples which is a simple gtk program.

As I am using fedora I installed gtkd and gtkd-devel using yum but when I come to compile using dmd I get the following error:

gtkBasic.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

Solution

  • You need to pass the path to the gtk root folder with the -I compiler option (same in C). Normally pkg-config should work, something like that dmd $(pkg-config --cflags --libs gtkd2) gtkBasic.d.