Imam priliku raditi na sistemu baziranim na intel XScale procesoru na kojem se vrti linux embedded te ima Xorg server,
manualu piše da je TinyX/Xfree86.
Server se uredno podigne i nekakvi test programčići uredno rade.
Napravio sam simple Xlib test program koji kreira prozor. Kad napravim cross kompajliranje javi mi greške za sve funkcije sadržane u Xlib.h filu.
Kad ukucam:
arm-linux-gcc -Wall source.c source -lX11
Code:
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:640: error: parse error before "XPointerMovedEvent"
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:647: error: parse error before "Window"
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:649: error: parse error before "subwindow"
.
.
.
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/stdio.h:46: error: syntax error before "typedef"
x.c: In function `main':
x.c:11: error: `Window' undeclared (first use in this function)
x.c:11: error: (Each undeclared identifier is reported only once
x.c:11: error: for each function it appears in.)
x.c:11: error: parse error before "rootwin"
x.c:13: error: `Colormap' undeclared (first use in this function)
x.c:24: error: parse error before "dpy"
x.c:25: error: `rootwin' undeclared (first use in this function)
x.c:25: error: parse error before "dpy"
x.c:26: error: parse error before "dpy"
x.c:29: error: `win' undeclared (first use in this function)
x.c:30: error: parse error before "dpy"
x.c:30: error: parse error before "dpy"
x.c:36: error: parse error before "dpy"
x.c:38: error: `ExposureMask' undeclared (first use in this function)
x.c:38: error: `ButtonPressMask' undeclared (first use in this function)
x.c:43: error: `e' undeclared (first use in this function)
x.c:44: error: `Expose' undeclared (first use in this function)
x.c:46: error: `ButtonPress' undeclared (first use in this function)
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:640: error: parse error before "XPointerMovedEvent"
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:647: error: parse error before "Window"
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/X11/Xlib.h:649: error: parse error before "subwindow"
.
.
.
/opt/arcom/lib/gcc/arm-linux/3.4.4/../../../../arm-linux/include/stdio.h:46: error: syntax error before "typedef"
x.c: In function `main':
x.c:11: error: `Window' undeclared (first use in this function)
x.c:11: error: (Each undeclared identifier is reported only once
x.c:11: error: for each function it appears in.)
x.c:11: error: parse error before "rootwin"
x.c:13: error: `Colormap' undeclared (first use in this function)
x.c:24: error: parse error before "dpy"
x.c:25: error: `rootwin' undeclared (first use in this function)
x.c:25: error: parse error before "dpy"
x.c:26: error: parse error before "dpy"
x.c:29: error: `win' undeclared (first use in this function)
x.c:30: error: parse error before "dpy"
x.c:30: error: parse error before "dpy"
x.c:36: error: parse error before "dpy"
x.c:38: error: `ExposureMask' undeclared (first use in this function)
x.c:38: error: `ButtonPressMask' undeclared (first use in this function)
x.c:43: error: `e' undeclared (first use in this function)
x.c:44: error: `Expose' undeclared (first use in this function)
x.c:46: error: `ButtonPress' undeclared (first use in this function)
Probao sam u KDE staviti source pa da mi automatski napravi autoconfig i automake te ukucam u promptu
./configure --prefix=/usr --target=/arm-linux
pa kad ukucam make
također dobijem ove greške
kao host koristim Fedoru Core 5 ha kojoj sve to radim.(sample na hostu uredno radi).
Code:
#include<X11/Xlib.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
Display *dpy;
Window rootwin;
Window win;
Colormap cmap;
XEvent e;
int scr;
GC gc;
if(!(dpy=XOpenDisplay(NULL))) {
fprintf(stderr, "ERROR: could not open display\n");
exit(1);
}
scr=DefaultScreen(dpy);
rootwin=RootWindow(dpy, scr);
cmap=DefaultColormap(dpy, scr);
win=XCreateSimpleWindow(dpy, rootwin, 1, 1, 100, 50, 0,
BlackPixel(dpy, scr), BlackPixel(dpy, scr));
XStoreName(dpy, win, "hello");
gc=XCreateGC(dpy, win, 0, NULL);
XSetForeground(dpy, gc, WhitePixel(dpy, scr));
XSelectInput(dpy, win, ExposureMask|ButtonPressMask);
XMapWindow(dpy, win);
while(1) {
XNextEvent(dpy, &e);
if(e.type==Expose && e.xexpose.count<1)
XDrawString(dpy, win, gc, 10, 10, "Hello World!", 12);
else if(e.type==ButtonPress) break;
}
XCloseDisplay(dpy);
return 0;
}
#include<X11/Xlib.h>
#include<stdio.h>
#include<stdlib.h>
int main()
{
Display *dpy;
Window rootwin;
Window win;
Colormap cmap;
XEvent e;
int scr;
GC gc;
if(!(dpy=XOpenDisplay(NULL))) {
fprintf(stderr, "ERROR: could not open display\n");
exit(1);
}
scr=DefaultScreen(dpy);
rootwin=RootWindow(dpy, scr);
cmap=DefaultColormap(dpy, scr);
win=XCreateSimpleWindow(dpy, rootwin, 1, 1, 100, 50, 0,
BlackPixel(dpy, scr), BlackPixel(dpy, scr));
XStoreName(dpy, win, "hello");
gc=XCreateGC(dpy, win, 0, NULL);
XSetForeground(dpy, gc, WhitePixel(dpy, scr));
XSelectInput(dpy, win, ExposureMask|ButtonPressMask);
XMapWindow(dpy, win);
while(1) {
XNextEvent(dpy, &e);
if(e.type==Expose && e.xexpose.count<1)
XDrawString(dpy, win, gc, 10, 10, "Hello World!", 12);
else if(e.type==ButtonPress) break;
}
XCloseDisplay(dpy);
return 0;
}
E još jedno pitanje koji library je sličan kao u DOS-u (BGI i graphic.h) odnosno može li se takvo što postići i u linuxu...
Eto hvala
unaprijed zahvaljujem
There are 10 types of people in the world:
Those who understand binary and those who don't.
Those who understand binary and those who don't.