我沿着教程以下在線,我知道我在做一個很初級語法錯誤的地方,但相較於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
}
請檢查下面給出的答案,謝謝。 –