This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How can i link to X11 with gcc?


You are on the right track by using -L/usr/X11R6/lib as your library.  Also,
-lX11 is correct, but you are missing some others...  For instance, XDrawPoint
is located in (I think) libXaw.a, so you also need -lXaw .  I have noticed that
some X calls are located in libraries that you wouldnt normally expect on other
*nix platforms.  Just keep adding libraries, until you have no more
dependencies.  Very often, for a smiple X app, I often find libraries such as
ICE and SM are also needed.

The way I find the lib to use, I use `nm /usr/X11RC/lib/*.a > ~/nmout`.  This
finds the symbols that the libraries use, and puts it to a text file.  I then
search for the symbol gcc is complaining about, and then search up for the
library associated with it.  There might be a better way, but this works pretty
well for me.

Brian


--- Oleg Giwodiorow <Oleg.Giwodiorow@gmx.net> wrote:
> Hi,
> I suppose this question is stupid, but i can not figure it out myself...
> 
> How can i link to X11 libraries with gcc ?
> 
> if i try to compile with :
> "gcc -L/usr/lib -lX11 ..." i recieve the error message :
> "cannot find -lX11"
> 
> If i change the makefile, so the path is setted, where the libX11.a is :
> "gcc -L/usr/X11R6/lib -lX11 ..." i recieve lots of errors like :
> "undefined refernce to 'XDrawPoint'"
> Most of the listed Functions are includet with Xlib.h (i suppose all, but
> they are to many to verify each of them).
> 
> Excuseme for my weak english and
> thank You;
> Oleg
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]