I wrote a simple program to check if xdotool can fulfill my requirements. (Well, not really. My first step is to make sure I can call the xdotool library.)
#include <xdo.h> #include <iostream> using namespace std; int main(){ cout << xdo_version() << endl; xdo_new(NULL); return 0; }
However, when I compile this with g++ -oa main.cpp libxdo.a -lXtst -lX11 -lXinerama -I ../test/xdotool-2.20110530.1 , I get the following error message:
/tmp/ccW95RQx.o: In function `main': main.cpp:(.text+0x5): undefined reference to `xdo_version()' main.cpp:(.text+0x29): undefined reference to `xdo_new(char*)' collect2: error: ld returned 1 exit status make: *** [sendkey] Error 1
I did not use development packages from apt-get install, because it installs a dynamic library. So, I did apt-get source and built the library myself. I checked that xdo_version and xdo_new are specific functions in the static library by executing the following commands:
$ nm libxdo.a | grep xdo_version 00000000000002b0 T xdo_version $ nm libxdo.a | grep xdo_new 0000000000004070 T xdo_new 0000000000003c90 T xdo_new_with_opened_display
If I am not mistaken, T in addition to the name of the symbol means that the function is defined.
In conclusion, I am trying to compile the above C ++ code snippet and statically bind it to xdotool, but I encountered some errors as mentioned above.
source share