title: Game Engine Matrices Multiplication
body: <p>I have been following TheChernoProject's tutorials on how to make a game engine, but so far I have been getting an error that I can't seem to figure out how to resolve it. 
  <a href="https://www.youtube.com/watch?v=5-minbbZW14&amp;list=PLlrATfBNZ98fqE45g3jZA_hLGUrD4bo6_&amp;index=9" rel="nofollow noreferrer">Here is the link to the episode where I am currently at, my problem starts at 28:40.</a>
  I keep on getting the error "Control reaches end of non-void function."
  I am using Xcode.</p>
  
  <p>This is mat4.cpp</p>
  
  <pre><code>#include "mat4.h"
  
  namespace engine { namespace maths {
  
  mat4::mat4() {
      for(int i=0;i&lt;4*4;i++) {
          elements[i] = 0.0f;
  
      }
  
  }
  
  mat4::mat4(float diagonal) {
      for(int i=0;i&lt;4*4;i++) {
          elements[i] = 0.0f;
  
          elements[0 + 0 * 4] = diagonal;
          elements[1 + 1 * 4] = diagonal;
          elements[2 + 2 * 4] = diagonal;
          elements[3 + 3 * 4] = diagonal;
  
  
      }
  
  }
  
  mat4 mat4::identity() {
      return mat4(1.0f);
  
  }
  
  mat4&amp; mat4::multiply(const mat4&amp; other) {
      for(int y=0;y&lt;4;y++) {
          for(int x=0;x&lt;4;x++) {
              float sum = 0.0f;
              for(int e=0;e&lt;4;e++) {
                  sum += elements[x + e * 4] * other.elements[e + y * 4];
  
              }
              elements[x + y * 4] = sum;
  
          }
  
      }
  
  }
  
  } }
  </code></pre>
  
  <p>Here is the the header file mat4.h</p>
  
  <pre><code>#pragma once
  
  #include "maths.h"
  
  namespace engine { namespace maths {
  
  struct mat4 {
      float elements[4 * 4];
  
      mat4();
      mat4(float diagonal);
  
      static mat4 identity();
  
      mat4&amp; multiply(const mat4&amp; other);
      friend mat4 operator*(mat4 left, const mat4&amp; right);
      mat4&amp; operator*=(const mat4&amp; other);
  
      static mat4 orthographic(float left, float right, float bottom, float top, float near, float far);
      static mat4 perspective(float fov, float aspectRatio, float near, float far);
  
      static mat4 translation(const vec3&amp; translation);
      static mat4 rotation(float angle, const vec3&amp; axis);
      static mat4 scale(const vec3&amp; scale);
  };
  
  } }
  </code></pre>