2014-11-23 79 views
0

我从AUR安装了GtkD,现在我正在尝试编译this tutorial code。无论是编译GtkD本身还是教程代码,我都使用GDC 4.9.1。在一个简单的程序上从GtkD中获取巨大的错误信息

我试图编译代码如下(hello.d是文件名):

gdc -Wall -Werror -Wdeprecated -Wunknown-pragmas -g -m64 `pkg-config --cflags --libs gtkd-2` -O3 -frelease -o hello 

但是当我尝试,我得到这个

/tmp/ccxejYOB.o: In function `_Dmain': 
/home/koz/Documents/Programming/D/gtkd/hello.d:23: undefined reference to `_D3gtk4Main4Main4initFKAAyaZv' 
/home/koz/Documents/Programming/D/gtkd/hello.d:24: undefined reference to `_D3gtk10MainWindow10MainWindow7__ClassZ' 
/home/koz/Documents/Programming/D/gtkd/hello.d:24: undefined reference to `_D3gtk10MainWindow10MainWindow6__ctorMFAyaZC3gtk10MainWindow10MainWindow' 
/home/koz/Documents/Programming/D/gtkd/hello.d:26: undefined reference to `_D3gtk5Label5Label7__ClassZ' 
/home/koz/Documents/Programming/D/gtkd/hello.d:26: undefined reference to `_D3gtk5Label5Label6__ctorMFAyabZC3gtk5Label5Label' 
/home/koz/Documents/Programming/D/gtkd/hello.d:28: undefined reference to `_D3gtk4Main4Main3runFZv' 
/tmp/ccxejYOB.o:(.data+0x30): undefined reference to `_D3gtk10MainWindow12__ModuleInfoZ' 
/tmp/ccxejYOB.o:(.data+0x38): undefined reference to `_D3gtk5Label12__ModuleInfoZ' 
/tmp/ccxejYOB.o:(.data+0x40): undefined reference to `_D3gtk4Main12__ModuleInfoZ' 
/tmp/ccxejYOB.o:(.data._D67TypeInfo_S3std8typecons35__T6scopedTC5cairo7Context7ContextZ6Scoped6__initZ[_D67TypeInfo_S3std8typecons35__T6scopedTC5cairo7Context7ContextZ6Scoped6__initZ]+0x58): undefined reference to `_D3std8typecons35__T6scopedTC5cairo7Context7ContextZ6Scoped6__dtorMFZv' 

没有线索这里发生了什么事情,并会感谢所有可能的帮助。

+0

[GtkD undefined reference]的可能重复(http://stackoverflow.com/questions/23863213/gtkd-undefined-reference) – 2014-11-23 22:06:41

回答

1

AUR中的GtkD使用DMD进行编译。不保证DMD和GDC二进制文件之间的ABI兼容性,并且链接可能会失败,就像您的情况一样。 (链接也可能成功,您会遇到运行时问题)。要解决这个问题,您可以尝试使用DMD并查看是否解决了您的问题。

无论如何,我会建议使用配音注册表中的dubgtk-d库。配音将负责编译您的源代码和gtk-d的代码并将它们链接在一起。它将使您能够轻松使用任何编译器。

如果你不想使用dub,你也可以下载gtk-d并使用GDC自己构建它。