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


Kevin Farrell writes:
 > 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 assuming this is just an example, and not cut-n-pasted from
what you actually did. :-)]

 > 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?

The purpose of -o is simply to specify the name of the output file,
nothing more.  Try gcc -S hello.c -o hello and see what you get.

Based on reading the sources (I don't use the ppc toolchain myself),
you have to specify either a linker script or more usually you
specify the name of the target "board" (or simulator).
This is even documented in the fine manual.

info -f gcc.info -n 'RS/6000 and PowerPC Options'
[or if you want, just grep for yellowknife in gcc/invoke.texi]

I haven't tried it but maybe something along these lines:

powerpc-eabi-gcc -msim hello.o -o hello

will, for example, specify the right startup files and libraries to use in
order to run `hello' on the simulator.

------
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]