Using BFD library - linker problems
Ian Lance Taylor
ian@zembu.com
Mon Jun 25 10:44:00 GMT 2001
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
More information about the Binutils
mailing list