Reputation: 73
I do not know what to with this error. I searched for some solutions, but nothing helps.
"error LNK2019: unresolved external symbol __ imp__glDrawArrays"
#include <stdio.h>
#include <stdlib.h>
#include <GL\glew.h>
#include <GLFW\glfw3.h>
int main()
{
if(glfwInit()==false){
//Did not succeed
fprintf(stderr, "GLFW faild ");
return -1;
}
glfwWindowHint(GLFW_SAMPLES,4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window;
window = glfwCreateWindow(640,480,"Hallo Welt",NULL,NULL);
if(!window)
{
fprintf(stderr, "Window failed");
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if(glewInit() != GLEW_OK)
{
fprintf(stderr, "glew init failed");
glfwTerminate();
return -1;
}
GLuint vaoID; //Vertex array erzeugt
glGenVertexArrays(1, &vaoID);
glBindVertexArray(vaoID); // wir verwenden das VA
static const GLfloat verts[] = {
-1.0f,-1.0f,0.0f,
1.0f,-1.0f,0.0f,
0.0f,1.0f,0.0f};
//Generate VBO
GLuint vboID;
glGenBuffers(1, &vboID);
glBindBuffer(GL_ARRAY_BUFFER,vboID);
glBufferData(GL_ARRAY_BUFFER,sizeof(verts),verts,GL_STATIC_DRAW);
do{
glDisableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER,vboID);
glVertexAttribPointer(0, 3,GL_FLOAT,GL_FALSE,0,(void*)0);
glDrawArrays(GL_TRIANGLES,0,3);
glDisableVertexAttribArray(0);
glfwSwapBuffers(window);
glfwPollEvents();
} while(glfwWindowShouldClose(window)==false);
return 0;
}
I set my directories for my include and lib files. Under Linker->Input i have glew32.lib, glew32s.lib, glfw3dll.lib
If I delete the function glDrawArrays
the code works and i get the black window. But I want to draw a white triangle in the window.
Upvotes: 0
Views: 291
Reputation: 43319
You are linking to glew32.lib
(dynamic --> DLL) and glew32s.lib
(static)
glew32s.lib
- but make sure you add GLEW_STATIC
to pre-processor definitions when you use glew32s.lib
.
You are only linking to support libraries, not the actual OpenGL run-time that ships with Windows
OpenGL32.lib
to your libraries.Upvotes: 1