我沿着教程以下在线,我知道我在做一个很初级语法错误的地方,但相较于2010年给了我非常模糊的描述上的错误,我已经在我的主要程序测试了这些功能,他们的工作,但由于某种原因,呼吁从我的主,这些类的功能时,我不断收到error LNK2019: unresolved external symbol "public: __thiscall
VS 2010 C++错误LNK2019:无法解析的外部符号“公用:__thiscall
我的头文件:
#ifndef SHADER_H
#define SHADER_H
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <glew.h>; // Include glew to get all the required OpenGL headers
class Shader
{
public:
GLuint Program;
Shader(const GLchar* vertexPath, const GLchar* fragmentPath);
void Use();
};
#endif
我的cpp文件:
#pragma once
#ifndef SHADER_H
#define SHADER_H
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include "Shader.h"
#include <glew.h>
#include "Shader.h"
class Shader
{
public:
GLuint Program;
//I've tried Shader(const GLchar* vertexPath, const GLchar* fragmentPath)
//instead of Shader::Shader
Shader::Shader(const GLchar* vertexPath, const GLchar* fragmentPath)
{
//generates shader
}
// Uses the current shader
void Shader::Use()
{
glUseProgram(this->Program);
}
};
#endif
错误来这里: Main.cpp的
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <glew.h>
//#define GLEW_STATIC
// GLFW
#include <glfw3.h>
// Other includes
#include "Shader.h"
int main()
{
Shader ourShader("shader.vs","shader.fs"); <-- Error here
// Game loop
while (!glfwWindowShouldClose(window))
{
// Draw the triangle
OurShader.Use(); <-- Error here
}
请检查下面给出的答案,谢谢。 –