[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc and X



[Please don't send me private copies of list mail.]

On Mon, Dec 02, 2002 at 12:57:52PM +0000, Pedro Quaresma de Almeida wrote:
> Colin Watson writes:
>  > Indeed, you don't have a main(). If this is a driver rather than a
>  > program, perhaps you want to compile it as a shared object?
> 
> The program is in another file "exemplo.c", but the problem is in this
> driver.

Then you'll need 'gcc -c xdriver.c -o xdriver.o' so that it doesn't try
to link xdriver.c on its own. You need to do the link with both
xdriver.c and exemplo.c simultaneously.

>  > You need to link the X library using -lX11.
> 
> That's my problem! When I do 
> 
>       > gcc xdriver.c -shared -lX11 -o xdriver.so 
> 
> I get
> 
>       /usr/bin/ld: cannot find -lX11
>       collect2: ld returned 1 exit status

Ah, make that '-L/usr/X11R6/lib -lX11' then.

> But I have the xlibs...
> 
> ii  xlibs          4.1.0-5        X Window System client libraries
> ii  xlibs-dev      4.0.3-4        X Window System client library development

You might want to get those versions in sync.

> Is this a problem with the PATH,

No, PATH affects execution of binaries.

> I have tried to compile with
> 
> -I/usr/include
> 
> but without any luck.

That's the default, and wouldn't make any difference here anyway.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: