我最近在安装“keynav”(一种用于键盘控制鼠标指针的实用程序)时遇到了困难。第一个问题:
keynav.c:29:17: fatal error: xdo.h: No such file or directory
#include <xdo.h>
^
compilation terminated.
一旦解决了这个问题,第二个问题就解决了:
cc keynav.o -o keynav -lcairo -lXinerama -lglib-2.0 -lXext -lX11 -lXtst -lglib-2.0 -lxdo; \
keynav.o: In function `parse_mods':
keynav.c:(.text+0x16c): undefined reference to `xdo_symbol_map'
keynav.o: In function `cmd_start':
keynav.c:(.text+0x1a1e): undefined reference to `xdo_window_setclass'
keynav.o: In function `cmd_cursorzoom':
keynav.c:(.text+0x20bb): undefined reference to `xdo_mouselocation'
keynav.o: In function `cmd_windowzoom':
keynav.c:(.text+0x212f): undefined reference to `xdo_window_get_active'
keynav.o: In function `cmd_warp':
keynav.c:(.text+0x22d9): undefined reference to `xdo_mousemove'
keynav.c:(.text+0x22f5): undefined reference to `xdo_mouse_wait_for_move_to'
keynav.o: In function `cmd_click':
keynav.c:(.text+0x235f): undefined reference to `xdo_click'
keynav.o: In function `cmd_drag':
keynav.c:(.text+0x2487): undefined reference to `xdo_mouseup'
keynav.c:(.text+0x24c3): undefined reference to `xdo_keysequence_down'
keynav.c:(.text+0x24df): undefined reference to `xdo_mousedown'
keynav.c:(.text+0x24fd): undefined reference to `xdo_mousemove_relative'
keynav.c:(.text+0x251b): undefined reference to `xdo_mousemove_relative'
keynav.c:(.text+0x2555): undefined reference to `xdo_keysequence_up'
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'keynav' failed
make: *** [keynav] Error 1
不过,我现在已经成功安装了,所以我会发布答案,以防其他人需要它!
答案1
因此第一个问题是由于没有发展xdo 库的版本,并由
dnf install libxdo-devel
第二个问题是由于文件中keynav.c
有一堆来自xdo.h
头文件的错误命名的调用造成的。(我假设这里的版本之间存在一些不一致,但还没有调查过。)
无论如何,这些问题都可以手动修复,方法是在头文件中找到名称相似的函数,然后在源文件中编辑名称。以下是diff
修改后的结果和原始结果:
292c289
< const char **symbol_map = xdo_get_symbol_map();
---
> const char **symbol_map = xdo_symbol_map();
846c843
< xdo_set_window_class(xdo, zone, "keynav", "keynav");
---
> xdo_window_setclass(xdo, zone, "keynav", "keynav");
1004c1001
< xdo_get_mouse_location(xdo, &xloc, &yloc, NULL);
---
> xdo_mouselocation(xdo, &xloc, &yloc, NULL);
1019c1016
< xdo_get_active_window(xdo, &curwin);
---
> xdo_window_get_active(xdo, &curwin);
1048,1049c1045,1046
< xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
< xdo_wait_for_mouse_move_to(xdo, x, y);
---
> xdo_mousemove(xdo, x, y, viewports[wininfo.curviewport].screen_num);
> xdo_mouse_wait_for_move_to(xdo, x, y);
1062c1059
< xdo_click_window(xdo, CURRENTWINDOW, button);
---
> xdo_click(xdo, CURRENTWINDOW, button);
1100c1097
< xdo_mouse_up(xdo, CURRENTWINDOW, button);
---
> xdo_mouseup(xdo, CURRENTWINDOW, button);
1104,1105c1101,1102
< xdo_send_keysequence_window_down(xdo, 0, drag_modkeys, 12000);
< xdo_mouse_down(xdo, CURRENTWINDOW, button);
---
> xdo_keysequence_down(xdo, 0, drag_modkeys, 12000);
> xdo_mousedown(xdo, CURRENTWINDOW, button);
1109,1110c1106,1107
< xdo_move_mouse_relative(xdo, 1, 0);
< xdo_move_mouse_relative(xdo, -1, 0);
---
> xdo_mousemove_relative(xdo, 1, 0);
> xdo_mousemove_relative(xdo, -1, 0);
1112c1109
< xdo_send_keysequence_window_up(xdo, 0, drag_modkeys, 12000);
---
> xdo_keysequence_up(xdo, 0, drag_modkeys, 12000);
如您所见,只需要更改函数的名称,而不是参数。
[如果您不知道diff
:在这种情况下,每行上方的行---
都是新的(以 开头<
),而每行下方的行---
都是已更改的旧行(以 开头>
,并且您也需要在keynav.c
文件中进行更改。)]
希望有帮助!