title: linux/g++ Multiple definition on linking
body: <p>All related questions I was able to find do not detail my exact scenario, so I hope this is not considered a duplicate question.</p>
  
  <p>I have class A(using A.h to declare and A.cpp to define) that includes and uses functions from a Math.h.</p>
  
  <p>When I try to build my main.cpp to use object A that #includes the header for class A, I get a multiple definition error for every single math function defined in Math.h(Math.h does not have a .cpp, all functions/variables are defined in the header).</p>
  
  <p>A.h</p>
  
  <pre><code>#ifndef A_H
  #define A_H
  
  #include "Math.h"
  
  //Other #includes
  
  namespace MY_NAMESPACE
  {
      class A
      {
          public:
  
              A();
              //Variable/Function declarations
  
          private:
  
              //Variable/Function declarations
      };
  }
  
  #endif
  </code></pre>
  
  <p>A.cpp</p>
  
  <pre><code>#include "A.h"
  
  void MY_NAMESPACE::A::Func1()
  {
      //define
  }
  
  ect...
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "A.h"
  
  
  int main()
  {
      MY_NAMESPACE::A* a = new MY_NAMESPACE::A();
  
      delete a;
  
      return 0;
  }
  </code></pre>
  
  <p>Math.h(Declared and defined only in header)</p>
  
  <pre><code>#ifndef MATH_H
  #define MATH_H
  
  float DotProduct(Vector3 v1, Vector3 v2)
  {
      return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z);
  }
  
  #endif
  
  etc...
  </code></pre>
  
  <p>I am new to linux/g++. This has never caused any issue in the past when programming in Visual Studio on a Windows platform.</p>
  
  <p>This is pretty basic stuff, so I am rather baffled.</p>
  
  <p>makefile</p>
  
  <blockquote>
    <p>CC=g++
        FLAGS=-std=c++11 -g</p>
  
  <pre><code>build: clean A.o main
  
  clean:
    rm -f -v bin/*.*
  
  A.o:
    $(CC) -c $(FLAGS) A.cpp
  
  main:
    $(CC) $(FLAGS) main.cpp A.o
  </code></pre>
  </blockquote>
  
  <p>Any advice?</p>
  
  <p>EDIT Actual error snippit</p>
  
  <blockquote>
    <p>In function <code>WF_RPI::MATH::Normalize(WF_RPI::MATH::Vector3)':
    /home/pi/projects/WFRPI/TPx2SController/../WFStandard/WFSMath.h:574:
    multiple definition of
    </code>WF_RPI::MATH::Normalize(WF_RPI::MATH::Vector3)'
    Arcus.o:/home/pi/projects/WFRPI/Arcus/../TPx2SController/../WFStandard/WFSMath.h:574:
    first defined here bin//libtpx2s.a(tpx2s.o): In function
    <code>WF_RPI::MATH::Normalize(WF_RPI::MATH::Vector2)':
    /home/pi/projects/WFRPI/TPx2SController/../WFStandard/WFSMath.h:590:
    multiple definition of
    </code>WF_RPI::MATH::Normalize(WF_RPI::MATH::Vector2)'
    Arcus.o:/home/pi/projects/WFRPI/Arcus/../TPx2SController/../WFStandard/WFSMath.h:590:
    first defined here bin//libtpx2s.a(tpx2s.o): In function
    `WF_RPI::MATH::Magnitude(WF_RPI::MATH::Vector2)':</p>
  </blockquote>