作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试在 Ubuntu
linux 上编译和链接 Athena
Xt 程序。
我已经将程序编译成目标文件,但无论如何我都无法将它与 Xt 库链接。
我的链接器调用是
ld /usr/lib/x86_64-linux-gnu/libXt.a program.o
我收到此链接器错误
program.o: In function `main':
program.c:(.text+0x37): undefined reference to `XtInitialize'
program.c:(.text+0x42): undefined reference to `commandWidgetClass'
program.c:(.text+0x5e): undefined reference to `XtCreateManagedWidget'
program.c:(.text+0x75): undefined reference to `XtStrings'
program.c:(.text+0x7d): undefined reference to `XtAddCallback'
program.c:(.text+0x89): undefined reference to `XtRealizeWidget'
program.c:(.text+0x8e): undefined reference to `XtMainLoop'
我用 nm
探测了 Xt
库,那里有符号:
nm /usr/lib/x86_64-linux-gnu/libXt.a | grep XtInitialize
U _XtInitializeActionData
0000000000000360 T XtInitializeWidgetClass
00000000000018b0 T XtInitialize
U XtInitializeWidgetClass
00000000000006d0 T _XtInitializeActionData
U XtInitializeWidgetClass
知道哪里出了问题吗?
最佳答案
尝试:
ld program.o /usr/lib/x86_64-linux-gnu/libXt.a
ld 的参数顺序很重要,它希望在带有引用的目标文件之后找到库。
关于c - 对 'XtInitialize' 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33617367/
我正在尝试在 Ubuntu linux 上编译和链接 Athena Xt 程序。 我已经将程序编译成目标文件,但无论如何我都无法将它与 Xt 库链接。 我的链接器调用是 ld /usr/lib/x86
我是一名优秀的程序员,十分优秀!