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
> 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.
> "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.
>> 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.