title: ld: cannot find lc -ERROR
body: <p>My purpose is to link two codes using my own linker script and for the same, i have created a simple linker script (All help from around the internet)
  This is my linker script, "link.lds"</p>
  
  <pre><code>SECTIONS
  {
     . = 0x10000;
     .text : { *(.text) }
     . = 0x8000000;
     .data : { *(.data) }
     .bss : { *(.bss) }
  }
  </code></pre>
  
  <p>and my two simple C codes are as follows.
  1) l1.c</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  extern int a;
  int main()
  {
  printf("%d",a);
  return 0;
  }
  </code></pre>
  
  <p>AND
  2) l2.c</p>
  
  <pre><code>int a=111;
  </code></pre>
  
  <p>The commands that i use are:</p>
  
  <pre><code>gcc -c l1.c l2.c
  ld -o output -T link.lds l1.o l2.o -lc
  </code></pre>
  
  <p>After following the above steps, I encounter the following error:</p>
  
  <pre><code>ld:cannot find lc
  </code></pre>
  
  <p>on removing lc,</p>
  
  <pre><code>undefined reference to printf().
  </code></pre>
  
  <p>I also tried using -L/dirname which took me back to the undef reference to printf error.</p>
  
  <p>MAY I GET SOME HELP AND GUIDANCE ON THE SAME...
  PS- Im aware i could have gone conceptually wrong and/or might not be aware about the correct sequence of linker execution/working.
  Any help on the same would be highly appreciated.
  Many Thanks!</p>