tinycc/examples/ex4.c
grischka ad5f3758c3 Revert "Make ex1.c and ex4.c be executable on any systems"
Using /usr/bin/env tcc doesn't work as it was reported.  Revert to
using the full path which fails if the user installs tcc in non-default
location.  Then again this is just an example.

This reverts commit 27a428cd0f.
2012-06-12 15:45:13 +02:00

27 lines
615 B
C
Executable File

#!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
/* Yes, TCC can use X11 too ! */
int main(int argc, char **argv)
{
Display *display;
Screen *screen;
display = XOpenDisplay("");
if (!display) {
fprintf(stderr, "Could not open X11 display\n");
exit(1);
}
printf("X11 display opened.\n");
screen = XScreenOfDisplay(display, 0);
printf("width = %d\nheight = %d\ndepth = %d\n",
screen->width,
screen->height,
screen->root_depth);
XCloseDisplay(display);
return 0;
}