This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

RE: Undefined Reference


Hi Eddie,

I seem to remember having this error myself when I first tried to use my
Win32 hosted, Linux targetted cross gcc. As far as I can remember, I solved
it by including the path to the libraries explicitly on the compile line, in
the following manner:

gcc -o hello hello.c -L/lib -L/usr/lib

I'm curious why you seem to want to produce object code (hello.o) and yet
you're using the -o option. The purpose of that option is to produce an
executable. To produce object code you should use the -c option, in which
case you don't need the linker, and you shouldn't get the error. What do you
want to do?

Best wishes,

Kevin.

Kevin Farrell
Software Developer,
SEAGULL Business Software Ireland Ltd.,
Swords Plaza,
Swords,
Co. Dublin,
Ireland.

kfarrell@seagull.nl

-----Original Message-----
From: Mahesh
To: Eddie CHEUNG [ESD]; crossgcc@sourceware.cygnus.com
Sent: 17/02/00 12:17
Subject: Re: Undefined Reference

Try compiling in verbose, gcc prints out information showing where it
found subprograms it invoked..
ex
<xxxx>-gcc -v -S hello.c


> > "Eddie CHEUNG [ESD]" wrote:
> >
> > > I just built a cross complier hosted on solaris target to
powerpc-elf.
> > >
> > > When I test the cross gcc with my hello.c
> > >
> > > #include <stdio.h>
> > > int main()
> > > {
> > >  printf("Hello World\n");
> > >  return 0;
> > > }
> > >
> > > Errors come up:
> > >
> > > /opt/crossgcc/powerpc-elf/bin/gcc hello.c -o hello.o
> > > /opt/crossgcc/powerpc-elf/bin/ld: warning: cannot find entry
symbol _start; defaulting to 01800074
> > > /var/tmp/ccWKCEit.o: In function `main':
> > > /var/tmp/ccWKCEit.o(.text+0x20): undefined reference to `printf'
> > > collect2: ld returned 1 exit status
> > > make: *** [hello.o] Error 1
> > >
> > > It seems to be the linker can not link the standard library. Can
anyone help?
> > >
> > > ------
> > > Want more information?  See the CrossGCC FAQ,
http://www.objsw.com/CrossGCC/
> > > Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sourceware.cygnus.com


------
Want more information?  See the CrossGCC FAQ,
http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sourceware.cygnus.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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