【问题标题】:Getting huge error spew from GtkD on a simple program在一个简单的程序上从 GtkD 得到巨大的错误
【发布时间】:2014-11-23 22:02:21
【问题描述】:

我从AUR 安装了GtkD,现在我正在尝试编译this tutorial code。为了编译 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

但是当我尝试这样做时,我得到了 this

/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'

不知道这里发生了什么,希望能得到所有可能的帮助。

【问题讨论】:

标签: d gdc gtkd


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-21
    • 2019-10-11
    • 2016-02-15
    • 1970-01-01
    • 1970-01-01
    • 2014-08-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多