我从奥尔安装了奥尔,现在我正在尝试编译本教程代码。在编译GtkD本身和教程代码时,我都使用GDC 4.9.1。
我试图按如下方式编译代码(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'我不知道这是怎么回事,我会感谢所有可能的帮助。
发布于 2014-11-24 16:38:36
AUR中的GtkD是使用DMD编译的。DMD和GDC二进制文件之间的ABI兼容性没有得到保证,链接可能会失败,就像在您的情况下一样。(链接也可能成功,您会遇到运行时问题)。要解决这个问题,您可以尝试使用DMD,看看它是否解决了您的问题。
无论如何,我建议使用dub注册表中的配音和gtk-d库。Dub将负责编译源代码和gtk-d的代码,并将它们链接在一起。它将使您能够轻松地使用任何编译器。
如果您不想使用dub,也可以下载gtk-d并使用GDC自己构建它。
https://stackoverflow.com/questions/27094898
复制相似问题