Hi,

        Its embarassing to discover that one doesnt really understand what
is going on in the compile and link process. This is what I recently found
out. The command 'gcc huffman.c codeheap.c' goes through perfectly.
However, the command 'gcc -c huffman.c' and 'gcc -c codeheap.c' followed
by 'ld huffman.o codeheap.o' gives me the following (on the link) :

ld: warning: cannot find entry symbol _start; defaulting to 08048074
huffman.o: In function `GetStats':
huffman.o(.text+0x5a): undefined reference to `fgetc'
huffman.o: In function `AddToLeftTree':
huffman.o(.text+0x9f): undefined reference to `malloc'
huffman.o: In function `AddToRightTree':
huffman.o(.text+0x107): undefined reference to `malloc'
huffman.o: In function `PrintTree':
huffman.o(.text+0x257): undefined reference to `printf'
huffman.o: In function `SortTree':
huffman.o(.text+0x280): undefined reference to `malloc'
huffman.o: In function `main':
huffman.o(.text+0x3ba): undefined reference to `printf'
huffman.o(.text+0x3d7): undefined reference to `fopen'
huffman.o(.text+0x3f8): undefined reference to `printf'

        This is essentially the same sort of behaviour that I get when I
do 'gcc huffman.c codeheap.c -nodefaultlibs', leading me to believe that
the default libraries need to be passed to the linker. The only question
is : where are these libraries? I cant locate any files like libc.a. I do
know where to find the libc.so* files, but I though that these were the
runtime libraries. 

        I am using a Redhat 5.0 distro. Could someone please enlighten me?

Kenneth


Reply via email to