[cs631apue] compile issue

mseaton mseaton at stevens.edu
Sun Sep 25 14:01:07 EDT 2016


It looks like you must use gcc -c option to compile source files 
individually and to use just gcc, you have to compile all connected 
source files at the same time. I think I answered my own question here.
Marlon
On 09/24/2016 8:37 PM, mseaton wrote:
> Hello,
>  Compiling each source file separately(using -c option), each file
> including the main one ls.c works fine. Also after compiling all
> source files together one one line also works okay, but if I compile
> ls.c by itself, I get the following:
> 
> undefined reference to `SortFileSize'
> ls.c:162: undefined reference to `PrintBlocks'
> ls.c:164: undefined reference to `LongFormat'
> ls.c:166: undefined reference to `PrintInodeNumber'
> 
> These functions are all .c files. I originally had include statements
> for each of these files (#include "PrintBlocks.s" for example) inside
> ls.c, but I removed them because I have a created header file that has
> these prototypes defined. Everything worked when I had these include
> files.
> 
> Should I put them back in or am I missing something? Also, all the
> other .c files has the header files I created.
> 
> Marlon
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue


More information about the cs631apue mailing list