Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Novice question (I guess) about finding a library

7 views
Skip to first unread message

André

unread,
Apr 11, 2002, 1:15:37 PM4/11/02
to
Hi

I'm trying to compile a simple xview application that came with xview
itself. It has a line

#include <xview/xview.h>

but when I type

$ gcc -lxview -lolgx -lX11 -o example example.c

it says it can't find the xview library. I have /usr/openwin/lib (that
is where the xview library lives) in my ld.so.conf file, and I have
runned ldconfig, but it still doesn't work. If I type

$ ld -lxview

I get "ld: cannot find -lxview"

but if I type

$ ld -lc

I get "ld: warning: cannot find entry symbol _start; not setting start
address". I suppose gcc isn't finding the library, but I don't know why.

If anybody knows it an answer it would be appriciated!

Thanks in advance.

--
© André Wagner


Mark A. Odell

unread,
Apr 11, 2002, 1:27:49 PM4/11/02
to
"André" <an...@syspoint.com.br> wrote in news:a94g7g$8qkr$1@ID-
77276.news.dfncis.de:

> Hi
>
> I'm trying to compile a simple xview application that came with xview
> itself. It has a line
>
> #include <xview/xview.h>
>
> but when I type
>
> $ gcc -lxview -lolgx -lX11 -o example example.c

Two hints:
1) Add -L/usr/local/blah to tell ld to look for libraries in /usr/local/blah
2) Break the gcc line into gcc -g -O -c example.c -o example.o and
ld example.o -L/usr/local/blah -lxview -lc (note, your stuff *before* the
libraries.

Paul Pluzhnikov

unread,
Apr 11, 2002, 9:59:40 PM4/11/02
to
"Mark A. Odell" <ma...@embeddedfw.com> writes:

> "André" <an...@syspoint.com.br> wrote in news:a94g7g$8qkr$1@ID-
> 77276.news.dfncis.de:
>

> Two hints:
> 1) Add -L/usr/local/blah to tell ld to look for libraries in /usr/local/blah
> 2) Break the gcc line into gcc -g -O -c example.c -o example.o and
> ld example.o -L/usr/local/blah -lxview -lc (note, your stuff *before* the
> libraries.

While you are correct about library order,
the "ld example.o ..." is a bad advice (especialy
for novice user):

- it is missing /lib/crt0.o, crtbegin.o, crtend.o, etc.
- user-level programs should generally avoid
using "ld" directly and always use the compiler
driver instead.

Mark A. Odell

unread,
Apr 11, 2002, 10:11:00 PM4/11/02
to
Paul Pluzhnikov <pa...@parasoft.com> wrote in
news:m3zo09e...@salmon.parasoft.com:

>> Two hints:
>> 1) Add -L/usr/local/blah to tell ld to look for libraries in
>> /usr/local/blah 2) Break the gcc line into gcc -g -O -c example.c -o
>> example.o and
>> ld example.o -L/usr/local/blah -lxview -lc (note, your stuff
>> *before* the libraries.
>
> While you are correct about library order,
> the "ld example.o ..." is a bad advice (especialy
> for novice user):
>
> - it is missing /lib/crt0.o, crtbegin.o, crtend.o, etc.
> - user-level programs should generally avoid
> using "ld" directly and always use the compiler
> driver instead.

Maybe for hosted apps. I do nothing but embedded apps. so I write my own
crt0.s and don't use crtbegin or end. Your point is well taken though, good
to point it out.

0 new messages