title: In function `_start': init.c:(.text+0x30): undefined reference to `main'
body: <p>I'm working on a C project with around 30 source files (.c). I'm building this project on a 32 bit micro-controller(i.MX515) running on Ubuntu using GNU tools.</p>
  
  <p>The compilation phase completes successfully, however when the linking process starts I get this error <em>(For full error at the end of the quesiton)</em>:</p>
  
  <pre><code>In function `_start': init.c:(.text+0x30): undefined reference to `main'
  </code></pre>
  
  <p>I have a <code>main()</code> function which does a simple <code>printf()</code>.</p>
  
  <p>My Makefile line for linking, looks like this.</p>
  
  <pre><code>final: $(OBJDIR)/main.o $(OBJDIR)/TchClaKnn_BuildKdtreeInt.o $(OBJDIR)/TchClaKnn_FreeKdtreeInt.o.... (Go upto 30 files like this)
      @echo ".Linking"
      $(CC) $(LFLAGS) -o $(OBJDIR)/main.o $(OBJDIR)/TchClaKnn_BuildKdtreeInt.o $(OBJDIR)/TchClaKnn_FreeKdtreeInt.o..... (Go upto 30 files like this)
  </code></pre>
  
  <p>Help!!!</p>
  
  <p>Regards</p>
  
  <p>Vikram</p>
  
  <hr>
  
  <p>Complete linking error</p>
  
  <pre><code>/usr/lib/gcc/arm-linux-gnueabi/4.3.3/../../../crt1.o: In function `_start':
  init.c:(.text+0x30): undefined reference to `main'
  collect2: ld returned 1 exit status
  make[1]: *** [final] Error 1
  make[1]: Leaving directory `/home/ubuntu/Documents/Project/IMX_Project_v1'
  make: *** [all] Error 2
  </code></pre>