【问题标题】:Undefined reference when compiling RemotePad编译 RemotePad 时未定义的引用
【发布时间】:2023-03-15 03:10:02
【问题描述】:

我正在尝试在 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

【问题讨论】:

    标签: linux ubuntu linux-mint


    【解决方案1】:

    最好使用:gcc remotepad.o ucs2keysym.o -o remotepad -lXtst -lX11 -lm 用于参数排序。未定义的引用肯定在 X11 库中。或许添加 -L/usr/X11/lib - 或 X 库所在的任何位置。

    【讨论】:

    • 成功了!谢谢你。 joe@joe-Inspiron-1720 ~/Downloads/RemotePad Server/X11 $ gcc remotepad.o ucs2keysym.o -o remotepad -lXtst -lX11 -lm -L/usr/lib
    • 不行。这样做之后,我运行 make 并得到错误:make: Nothing to be done for `all'。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-17
    • 2012-08-16
    • 2023-03-10
    • 2019-09-05
    • 2013-10-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多