title: C++ Compilation error:- multiple definition of `main' using Makefile
body: <p>I have three files with <code>Trigger.cpp</code> , <code>Trigger.h</code> and <code>corchainf.cpp</code> from which <code>corchainf.cpp</code> has <code>main()</code> function. Now when I am compiling these using make command I get the following error:-</p>
  
  <pre><code>corchainf.o: In function `main':
  corchainf.cpp:(.text+0x40): multiple definition of `main'
  
  
  corchainf.o:corchainf.cpp:(.text+0x40): first defined here
  
  collect2: ld returned 1 exit status
  
  make: *** [corchainf] Error 1
  </code></pre>
  
  <p>I am suspecting the error is in Makefile because everything else i have checked so this is the makefile
  <a href="https://i.stack.imgur.com/rwmgD.png" rel="nofollow noreferrer">makefile image 1</a>
  <a href="https://i.stack.imgur.com/IRL52.png" rel="nofollow noreferrer">makefile image 2</a></p>
  
  <p>Can anyone suggest where in makefile is the main() function which is in corchainf.cpp ; is being called multiple times??</p>
  
  <p>Edit:- Got the solution to problem. in makefile the corchainf.cpp which had main function was bieng called two times by $(MAINO) and $(OBJS) ; so removed $(MAINO) and VOILA!!! it worked. Thanks everyone for answering. </p>