I'm currently developing an OpenGL framework for video games. This framework contains a specific program that loads shaders. In the class of said program I have these three functions:
InitShaderProgram(...);
CreateShader(...);
CreateProgram(...);
The InitShaderProgram calls CreateShader and CreateProgram in such way:
bool ShaderLoader::InitShaderProgram(GLuint &Program)
{
std::vector<GLuint> ShaderList;
ShaderList.push_back(ShaderLoader::CreateShader(GL_VERTEX_SHADER, VertexShader));
ShaderList.push_back(ShaderLoader::CreateShader(GL_FRAGMENT_SHADER, FragmentShader));
Program = ShaderLoader::CreateProgram(ShaderList);
std::for_each(ShaderList.begin(), ShaderList.end(), glDeleteShader);
return GL_TRUE;
}
However, whenever I try to compile this code, it gives me two "unresolved external symbol" errors:
Error 4 error LNK2019: unresolved external symbol "public: virtual unsigned int __thiscall ShaderLoader::CreateProgram(class std::vector<unsigned int,class std::allocator<unsigned int> > const &)" (?CreateProgram@ShaderLoader@@UAEIABV?$vector@IV?$allocator@I@std@@@std@@@Z) referenced in function "public: bool __thiscall ShaderLoader::InitShaderProgram(unsigned int &)" (?InitShaderProgram@ShaderLoader@@QAE_NAAI@Z)
Error 3 error LNK2019: unresolved external symbol "public: virtual unsigned int __thiscall ShaderLoader::CreateShader(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?CreateShader@ShaderLoader@@UAEIIABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: bool __thiscall ShaderLoader::InitShaderProgram(unsigned int &)" (?InitShaderProgram@ShaderLoader@@QAE_NAAI@Z)
In my header file, I define these three functions as such:
bool InitShaderProgram(GLuint&);
GLuint CreateShader(GLenum, const std::string&);
GLuint CreateProgram(const std::vector<GLuint>&);
If I get this right (I most likely don't), the compiler does not understand where these functions come from. Can anyone help me out here?