X11 - GCC compiling options
hi,
i have a C program to compile with X11 library included
i tried compiling using these flags
____________________________________________________________
gcc -g -v -L/usr/X11R6/lib -lX11 -lXtst test.c
____________________________________________________________
and i am getting the following error
_____________________________________________________________
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
/usr/libexec/gcc/x86_64-redhat-linux/4.0.0/cc1 -quiet -v test.c -quiet -dumpbase test.c -mtune=k8 -auxbase test -g -version -o /tmp/ccyB1ded.s
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.0.0/include
/usr/include
End of search list.
GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8) (x86_64-redhat-linux)
compiled by GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8).
GGC heuristics: --param ggc-min-expand=68 --param ggc-min-heapsize=71720
as -V -Qy -o /tmp/cc0EFTJs.o /tmp/ccyB1ded.s
GNU assembler version 2.15.94.0.2.2 (x86_64-redhat-linux) using BFD version 2.15.94.0.2.2 20041220
/usr/libexec/gcc/x86_64-redhat-linux/4.0.0/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.0.0/crtbegin.o -L/usr/X11R6/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.0.0 -L/usr/lib/gcc/x86_64-redhat-linux/4.0.0 -L/usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 -lX11 -lXtst /tmp/cc0EFTJs.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.0.0/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.0.0/../../../../lib64/crtn.o
/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.so when searching for -lX11
/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.a when searching for -lX11
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
________________________________________________________________
Specs:
AMD64
2.6.11-1.1369_FC4 x86_64 GNU/Linux
C program sourcce code
____________________________________________________________
test.c
____________________________________________________________
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xlib.h>
int main(int argc, char* argv[]) {
Display *dpy;
dpy = XOpenDisplay(NULL);
if (argc!=2) {
printf("This program takes a single keysym name (such as A or U0041) as an argument\n");
return 1;
}
KeySym sym = XStringToKeysym(argv[1]);
int min, max, numcodes;
XDisplayKeycodes(dpy,&min,&max);
KeySym *keysym;
keysym = XGetKeyboardMapping(dpy,min,max-min+1,&numcodes);
keysym[(max-min-1)*numcodes]=sym;
XChangeKeyboardMapping(dpy,min,numcodes,keysym,(max-min));
XFree(keysym);
XFlush( dpy );
KeyCode code = XKeysymToKeycode(dpy,sym);
XTestFakeKeyEvent(dpy, code, True, 1);
XTestFakeKeyEvent(dpy, code, False, 1);
XFlush( dpy );
XCloseDisplay( dpy );
return 0;
}
_______________________________________________________________
Last edited by nawin_g; 04-23-2006 at 02:43 AM.
|