title: C++ makefile on Linux with Multiple *.cpp files
body: <p>I'm trying to make a makefile with multiple files. Can someone help me?
  The files I have are file1.cpp, file2.h and main.cpp</p>
  
  <p>file1.cpp contains my functions.
  file2.h contains the declaration of my functions.</p>
  
  <p>main.cpp [includes file2.h in the code]
  file1.cpp [includes file2.h in the code]</p>
  
  <p>i did </p>
  
  <pre><code>all: main
  gcc -g -Wall -o main main.cpp
  </code></pre>
  
  <p>but it gives me tons of bugs when i try to compile. my codes works perfectly fine on eclipse.</p>