title: LNK 2019 "Unresolved External Symbol" Error (C++ OpenGL)
body: <p>I'm relatively new to C++ and I've been having some problems while making classes in files. I'm trying to call a constructor from a separate class, Shader, and use a method in said class. However whenever I try to build the solution, I get the following error:</p>
  
  <pre><code>Error   2   error LNK2019: unresolved external symbol "public: void __thiscall Shader::Use(void)" (?Use@Shader@@QAEXXZ) referenced in function _main    
  Error   1   error LNK2019: unresolved external symbol "public: __thiscall Shader::Shader(char const *,char const *)" (??0Shader@@QAE@PBD0@Z) referenced in function _main
  </code></pre>
  
  <p>I know that there is nothing wrong with the Project Properties Linker or the rendering system because I've rendered things before with my current configuration, so I figure it must have something to do with the code but I can't figure it out:</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  // GLEW
  #define GLEW_STATIC
  #include &lt;GL/glew.h&gt;
  
  // GLFW
  #include &lt;GLFW/glfw3.h&gt;
  
  // Other includes
  #include "Shader.h"
  
  int main ()
  {
  
  (... Window Setup ...)
  
  
  // Build and compile shader program
  Shader shaders ("shader.vs", "shader.frag");
  
  
  (... Set up vertex data (and buffer(s)) and attribute pointers ...)
  
  // Game loop
  while(!glfwWindowShouldClose (window))
  {
      glfwPollEvents ();
  
      ourShader.Use ();
  
  (... Draw triangle ...)
  
      glfwSwapBuffers (window);
  }
  (... De-allocate all resources ...)
  
  (... Terminate window ...)
  return 0;
  }
  </code></pre>
  
  <p>Shader.h</p>
  
  <pre><code>#ifndef SHADER_H
  #define SHADER_H
  
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;iostream&gt;
  
  #include &lt;GL/glew.h&gt;
  
  class Shader
  {
  public:
  
  GLuint Program;
  Shader(const GLchar* vertexPath, const GLchar* fragmentPath);
  void Use ();
  
  };
  
  #endif
  </code></pre>
  
  <p>Shader.cpp</p>
  
  <pre><code>#ifndef SHADER_H
  #define SHADER_H
  
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;iostream&gt;
  
  #include &lt;GL/glew.h&gt;
  
  #include "Shader.h"
  
  class Shader
  {
  public:
  GLuint Program;
  Shader::Shader(const GLchar* vertexPath, const GLchar* fragmentPath)
  {
      (... 1. Retrieve the vertex/fragment source code from filePath ...)
  
      (... 2. Compile shaders ...)
  
      (... 3. Link shader program ...)
  
      (... 4. Delete shaders after usage ...)
  }
  
  void Shader::Use ()
  {
      (... Use current shader program ...)
  }
  };
  
  #endif
  </code></pre>
  
  <p>Any help would be greatly appreciated. If any more code is needed I can provide. Thanks in advance!</p>