title: Makefile Error : Command Not Found- while creating a shared library
body: <p>I have 4 .c files <code>hello.c</code>,<code>here.c</code>,<code>bye.c</code> and <code>main.c</code>.
  One header file <code>mylib.h</code> </p>
  
  <p>The contents are as follows</p>
  
  <p>hello.c</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void hello()
  {
      printf("Hello!\n");
  }
  </code></pre>
  
  <p>here.c </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void here()
  {
       printf("I am here \n");
  }
  </code></pre>
  
  <p>bye.c</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void bye()
  {
      printf("Bye,Bye");
  }
  </code></pre>
  
  <p>main.c </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include "mylib.h"
  
  int main()
  { 
  
    hello();
    here();
    bye();
    return 1;
  }
  </code></pre>
  
  <p>mylib.h </p>
  
  <pre><code>#ifndef _mylib_
  #define _mylib_
  
  void hello();
  void here();
  void bye();
  
  #endif
  </code></pre>
  
  <p>The makefile for creating a static lib is :
  Makefile</p>
  
  <pre><code>#Which Compiler
  CC = gcc
  
  #Compiler Flags
  CFLAGS = - Wall -c -fPIC
  
  DYNLINKFLAGS = -shared -W1,-soname,$@.0
  
  PROG = main
  
  PROG_OBJS = main.c
  
  LIB = mylib
  
  LIB_FILES = libmylib.so
  
  LIB_MINOR = $(LIB_FILES).0.1
  
  LIB_RELEASE = $(LIB_MINOR).0
  
  LIB_OBJS = hello.o here.o bye.o
  
  PATH = /home/srinivasa/cspp51081/labs/srinivasa.lab2.1
  
  all:    $(LIB_FILES) $(PROG)
  
  #Create Lib with this file
  $(LIB_FILES):   $(LIB_OBJS)
              $(CC) $(DYNLINKFLAGS) $^
              ln -sf $(LIB_RELEASE) $(LIB_MINOR)
              ln -sf $(LIB_MINOR) $@
              ln -sf $@ $@.0
  
  #Compiling main program and link with shared library
  $(PROG):        $(PROG_OBJS)
              $(CC) -o $(PROG) $(PORG_OBJS) -l$(LIB) -L$(PATH)
  
  main.o:         main.c
  hello.o:        hello.c
  here.o:         here.c
  bye.o:          bye.c
  
  #clean files
  clean:
              rm -rf $(LIB_OBJS) $(LIB_FILES) $(LIB_RELEASE) $(LIB_MINOR) libmylib.so.0
  </code></pre>
  
  <p>Problem: When I execute the command </p>
  
  <pre><code>make -f Makefile all 
  </code></pre>
  
  <p>I get the error:</p>
  
  <p>gcc -Wall -fPIC   -c -o hello.o hello.c
  make: gcc: Command not found
  make: <em>*</em> [hello.o] Error 127</p>
  
  <p>Questions : <code>How do I resolve this?</code></p>