linux - 编译 RemotePad 时 undefined reference

标签 linux ubuntu linux-mint

我正在尝试在 Linux Mint 12 上编译 RemotePad 服务器,但在 make 期间出现以下错误:


gcc -lXtst -lX11 -lm  -o remotepad remotepad.o ucs2keysym.o
remotepad.o: In function `handleKeyEvent':
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:369: undefined reference to `XKeysymToKeycode'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:371: undefined reference to `XTestFakeKeyEvent'
remotepad.o: In function `simulateKeyWithUnichar':
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:379: undefined reference to `XKeysymToKeycode'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:399: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:404: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:403: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:401: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:389: undefined reference to `XKeysymToKeycode'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:394: undefined reference to `XKeysymToKeycode'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:398: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:396: undefined reference to `XTestFakeKeyEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:391: undefined reference to `XKeysymToKeycode'
remotepad.o: In function `handleKeyEvent':
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:365: undefined reference to `XBell'
remotepad.o: In function `main':
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:125: undefined reference to `XOpenDisplay'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:130: undefined reference to `XTestQueryExtension'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:143: undefined reference to `XCreateWindow'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:148: undefined reference to `XDisplayKeycodes'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:150: undefined reference to `XGetKeyboardMapping'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:194: undefined reference to `XGetWindowAttributes'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:317: undefined reference to `XGetWindowAttributes'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:302: undefined reference to `XFlush'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:259: undefined reference to `XTestFakeButtonEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:260: undefined reference to `XTestFakeButtonEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:284: undefined reference to `XTestFakeButtonEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:233: undefined reference to `XTestFakeRelativeMotionEvent'
/home/joe/Downloads/RemotePad Server/X11/remotepad.c:126: undefined reference to `XDisplayName'
collect2: ld returned 1 exit status
make: *** [remotepad] Error 1

我用谷歌搜索了一下,它说要确保我安装了 Xsts 包。


/home/joe $ ls /usr/lib/libXtst*
/usr/lib/libXtst.a  /usr/lib/libXtst.so  /usr/lib/libXtst.so.6  /usr/lib/libXtst.so.6.1.0

最佳答案

最好使用:gcc remotepad.o ucs2keysym.o -o remotepad -lXtst -lX11 -lm 用于参数排序。 undefined reference 肯定在 X11 库中。或许添加 -L/usr/X11/lib - 或者 X 库所在的任何地方。

关于linux - 编译 RemotePad 时 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8310240/

相关文章:

linux - 它是相对路径还是绝对路径?

c - 打开使用 C 编写的文件时权限被拒绝

linux - 在哪里找到卸载文件

通过 Mint 上的两个 ssh 连接在 GUI 中连接 MySQL

c++ - 使用正则表达式和 sed 命令替换 C++ 代码中的 ' *' 指针不起作用

linux - 在 Linux mint 中配置用户终端

C++ linux 调试跟踪不出来

linux - 如何为每个用户设置 cron 作业

c - 如何确定linux控制消息中多个辅助消息的大小

ubuntu - Launchpad 的下载器?