1

I am using the Raspberry P as a headless system, and i want to compile a C program to move the mouse cursor in an X window.

In details:(I am viewing my Pi's desktop on my windows laptop, and i want to compile the code in the raspberry pi using Geany or the terminal window with gcc) I've installed the library using "sudo apt-get install libx11-dev", and tried to use the XWarpPointer function, but I've a compilation error says: x11/x.h no such file or directory.

1-How can i fix that? 2-Should i use the SetCursorPos() function insted of XWarPointer()?

SMR
  • 11
  • 2
  • Why do you have a GUI in a headless system? – Steve Sep 01 '15 at 16:17
  • i'm not sure that i understand what you meant, but i'm using the VNC viewer to display the Pi's desktop on my laptop screen. – SMR Sep 01 '15 at 16:25
  • Ah, I see. My RPi is my DHCP server (among other things), and is headless. My only (human) interface is via ssh and a terminal. – Steve Sep 01 '15 at 16:27
  • Do you have an X-server on it? – Eugene Sh. Sep 01 '15 at 16:39
  • [related question](http://stackoverflow.com/questions/5966903/how-to-get-mousemove-and-mouseclick-in-bash) – Eugene Sh. Sep 01 '15 at 16:41
  • @EugeneSh. i have edit my question to clear point. – SMR Sep 01 '15 at 16:53
  • Can you get xterm showing on your laptop at all? – Eugene Sh. Sep 01 '15 at 16:57
  • sorry,i did not understand. I'm still new for this. – SMR Sep 01 '15 at 17:07
  • The X is uppercase. And you probably want [`X11/Xlib.h`](https://tronche.com/gui/x/xlib/introduction/header.html) instead. – Leiaz Sep 01 '15 at 17:17
  • @Leiaz, Yes you where right, also the functions needed to be an uppercase. For the compilation i needed to add 'gcc text.cpp -lX11 -o t' in the terminal window,but for Geany still can't find the references to XOpenDisplay and the other functions. – SMR Sep 02 '15 at 08:29
  • When i run it I've got this:"client is not authorized to connect to server ".how to fix that? – SMR Sep 02 '15 at 08:31
  • StackOverflow isn't a discussion forum. Different questions should be asked as separate questions (although you can probably edit that one as it wasn't very clear and doesn't have an answer). If you haven't already, you should read [the tour](http://stackoverflow.com/tour), the [How to ask](http://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) help pages. You need to include a small program that demonstrate the error you are getting and explain your VNC setup clearly in your question. – Leiaz Sep 02 '15 at 15:51
  • Also search first. Google have plenty of results for configuring Geany's compiler command. And if you google your error message, you can get ideas on what could be wrong with your setup, and what configuration details you should include in your question if you don't find a solution. – Leiaz Sep 02 '15 at 15:52

0 Answers0