function reference from standard library
Dony
dony@willowglen.com.sg
Tue Oct 13 00:42:00 GMT 1998
Yeah, I suspect also the same, since even main function reference
wasn't found.
x----------
main.o(.text+0x18):main.c undefined reference to '__main'
x----------
I don't know what I have done wrong.
I have already included the directory of std. header file
during compiling, and also the library during linking.
My makefile like this :
X----------
CC = m68k-coff-gcc
LD = m68k-coff-ld
# Here located all the standard header files
INC = c:/gcc-m68k/m68k-coff/include
# Here located all the 'lib*.a'
LIB = c:/gcc-m68k/m68k-coff/lib/m68000
CFLAGS = -m68000 -ansi -Wall -O2 -I$(INC)
LDFLAGS = -s -n -Tmsdsl.ld -L$(LIB)
PROG = crt0.o control.o extern.o gti_avm.o gti_be.o gti_cof.o gti_ipu.o
\
gti_sas.o gti_tr.o gtidebug.o gtifram.o gtihip.o gtiinit.o \
gtiparam.o gtiram.o gtixcvr.o hdlc.o hic.o main.o malloc.o \
scc.o uart.o vers.o
driver: msdsl.ld $(PROG)
$(LD) $(LDFLAGS) -Map=driver.map -o driver.x $(PROG)
crt0.o: crt0.S asm.h mc68302.h
$(CC) $(CFLAGS) $< -c -o $@
...............
...............
...............
X----------
--
Dony
Email : dony@willowglen.com.sg
C. M. Heard/VVNET, Inc. wrote:
>
> On Mon, 12 Oct 1998, Dony wrote:
>
> > Hii all,
> >
> > Another confusion in GCC :
> > In my code I use 'strlen()' from standard library 'string.h'
> > I have already included the header --->>> #include <string.h>
> > Code is successfuly being compiled, but during linking, an error happens
> > --->>> main.c(.text+0x666):main.c: undefined reference to strlen
>
> Apparently the linker is not finding your libraries.
>
> >
> > Beside that I get a warning (I don't know would whether it will effect
> > the functionality of my program or not), as I define main(){ ....}.
> > The message is like this :
> > main.c:51: warning: return-type defaults to 'int' --->>> point to line
> > begin of fucntion main()
> > main.c:153: warning: control reaches end of non-void function --->>>
> > point to end of function main()
>
> The declaration "main ()" is equivalent to "int main ()", as it has been
> since K&R C days. I think that the latest ISO C standard has decreed that
> the omission of "int" in a declaration is an anachronism, and for this
> reason it draws a warning from gcc. You should change your declaration
> to "int main (void)" [not "void main (void)" ... I don't think that's
> considered legal anymore, if it ever was] and end the function with
> "return 0" to stop these complaints.
>
> >
> > Can anybody explain on that??
> > Thank's
> >
> > --
> > Dony
> > Email : dony@willowglen.com.sg
>
> Mike
> --
> C. M. Heard/VVNET, Inc.
> heard@vvnet.com
>
> ________________________________________________
> To get help for the crossgcc list, send mail to
> crossgcc-request@cygnus.com with the text 'help'
> (without the quotes) in the body of the message.
________________________________________________
To get help for the crossgcc list, send mail to
crossgcc-request@cygnus.com with the text 'help'
(without the quotes) in the body of the message.
More information about the crossgcc
mailing list