This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: Linking error


naga raj <gnuuser.raj@gmail.com> writes:

>     I am using arm compiler to run a simple c++ program
>
>  #include <iostream>
>  #include <cstdlib>
>  using namespace std;
>
>  int main(int argc, char* argv[])
>  {
>                 cout <<"hi" <<endl;
>                 return 0;
>   }
>
>   It was compiled sucessfully but in linking it is throwing following errors
>
>   arm-eabi-g++ -Wl,-T -Wl,../src/lscript.ld
> -L../../empty_cpp_bsp_0/lib -o"empty_cpp_0.elf"  ./src/main.o
> -Wl,--start-group,-llocal,-lgcc,-lc,-lstdc++,--end-group
>
> ../../empty_cpp_bsp_0/lib/liblocal.a(close.o): In function `close':
> /proj/empty_cpp_bsp_0//libsrc/src/close.c:50: multiple definition of `close'
> /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysclose.o):sysclose.c:(.text+0x0):
> first defined here
>
> ../../empty_cpp_bsp_0/lib/liblocal.a(fstat.o): In function `fstat':
> /proj/arm/empty_cpp_bsp_0/libsrc/src/fstat.c:51: multiple definition of `fstat'
> /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a(lib_a-sysfstat.o):sysfstat.c:(.text+0x0):
> first defined here
> collect2: ld returned 1 exit status
> make: *** [empty_cpp_0.elf] Error 1
>
> My requirement is to pick close() & fstat() functions from
> /proj/empty_cpp_bsp_0/lib/liblocal.a not from
> /bin/../lib/gcc/arm-eabi/4.6.1/../../../../arm-eabi/lib/libc.a
>
> I have included my local library with -L../../empty_cpp_bsp_0/lib..
>
> Can anyone please help me in fixing this compilation issue..

This isn't really a compiler issue.  There is something wrong with your
libraries.  Those libraries did not come from GCC, and I don't know
where they came from.

You can try using the option -Wl,foo.map and then looking in the foo.map
file to see why the different objects are being included.  That may
suggest how to fix your libraries.

Ian


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