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
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top