I've encountered a perplexing issue while compiling a program. Despite having the stdio.h file in /usr/include and compiling with the gcc command without errors, I still encounter the following error when executing the make command:fatal error: stdio.h: No such file or directory
I've already executedsudo apt-get install libc6-dev
so I'm puzzled as to why this error persists. Any insights or suggestions would be greatly appreciated. Thank you!
program:
#include <stdio.h>#include <X11/Xlib.h>#include <X11/Xutil.h>int main() { Display *display; Window root_window; XEvent event; // Open display connection display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "Unable to open display connection\n"); return 1; } // Get the root window root_window = XRootWindow(display, DefaultScreen(display)); // Listen for mouse button events XGrabButton(display, AnyButton, AnyModifier, root_window, True, ButtonPressMask | ButtonReleaseMask, GrabModeSync, GrabModeAsync, None, None); printf("Intercepting mouse events...\n"); // Enter event loop while (1) { XNextEvent(display, &event); if (event.type == ButtonPress) { printf("Mouse button press event intercepted\n"); // Add your handling logic here } else if (event.type == ButtonRelease) { printf("Mouse button release event intercepted\n"); // Add your handling logic here } } // Close display connection XCloseDisplay(display); return 0;}
Makefile:
obj-m += program2.oall: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules EXTRA_LDFLAGS="-L/usr/lib -lX11"clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I hope to run the 'make' command without encountering any errors.