mirror of
https://github.com/frida/tinycc
synced 2024-12-28 07:39:40 +03:00
27a428cd0f
Use /usr/bin/env to make ex1.c and ex4.c on any systems, wherever is installed tcc.
27 lines
613 B
C
Executable File
27 lines
613 B
C
Executable File
#!/usr/bin/env 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;
|
|
}
|