This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Using BFD library - linker problems
- To: Grzegorz Ilczuk <Grzegorz dot Ilczuk at heitec dot de>
- Subject: Re: Using BFD library - linker problems
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 25 Jun 2001 10:18:30 -0700
- Cc: binutils at gcc dot gnu dot org
- References: <3B3739CE.14856159@heitec.de>
Grzegorz Ilczuk <Grzegorz.Ilczuk@heitec.de> writes:
> I would like to access and modify ELF files from a program written in
> C, so according to the documentation I have included 'bfd.h' and have
> tried to link a program with 'libbfd.a'. But I have got some error
> messages :
> [pc-grzilc : grzilc] bfd >gcc hello.c -lbfd
> /usr/lib/libbfd.so: undefined reference to `objalloc_create'
> /usr/lib/libbfd.so: undefined reference to `xstrerror'
> /usr/lib/libbfd.so: undefined reference to `hex_init'
> /usr/lib/libbfd.so: undefined reference to `concat'
> /usr/lib/libbfd.so: undefined reference to `_objalloc_alloc'
> /usr/lib/libbfd.so: undefined reference to `_hex_value'
> /usr/lib/libbfd.so: undefined reference to `objalloc_free_block'
> /usr/lib/libbfd.so: undefined reference to `objalloc_free'
> /usr/lib/libbfd.so: undefined reference to `xexit'
> collect2: ld returned 1 exit status
>
> Please help me how should I use the library. I'm just started to use
> Linux and I don't know which library is missing or what is wrong.
You need to also link with -liberty. (-lbfd -liberty).
Ian