This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using BFD library - linker problems


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]