Hacker News new | past | comments | ask | show | jobs | submit login

I was able to compile it on Ubuntu after moving the X11 includes to the bottom of the list:

  #include <stdio.h>
  #include <strings.h>
  #include <string.h>
  #include <stdlib.h>
  #include <stdint.h>
  #include <inttypes.h>
  #include <stdarg.h>
  #include <math.h>
  #include <X11/Xlib.h>
  #include <X11/Xlibint.h>
  #include <X11/Xproto.h>
  #include <X11/Xatom.h>
  #include <X11/extensions/Xrandr.h>
  #include <X11/extensions/Xrender.h>



Thank you, had the same problem on Debian. This made it work.


I also had to do some fiddling with the includes (removing the `strings.h` include got it working for me. Why is this required?


Historically, including some headers ended up including some other headers automatically, such that the author might not realize what headers the file depends on, because it compiles without them explicitly included. glibc (and maybe gcc and xlib?) have been cleaning this up where possible, slowly over time. So a file that had "correct enough" includes for an older glibc might now be caught not including a header it needed all along.

Or maybe it's a similar situation but actually related to "feature test macros" (see https://lwn.net/Articles/590381/)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: