Click here to Skip to main content
15,882,152 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tryed to start a new project with OpenGL on VC++ 2010. But I don't get my project working and there is always the same error message.

#include <GL/glew.h>
#include <GL/freeglut.h>
#include <Windows.h>
#include "textReader.h"

int screenX=GetSystemMetrics(SM_CXSCREEN)-100;
int screenY=GetSystemMetrics(SM_CYSCREEN)-100;

static void RenderSceneCB()

static void InitializeGlutCallbacks()

static void AddShader(char* shaderDir, GLenum Shadertype)
	 GLuint shaderID = glCreateShader(Shadertype);

	 TextReader shader = TextReader(shaderDir);

	 glShaderSource(shaderID, shader.getCount(), (const GLchar**) shader.getContent(), shader.getLength());

int main(int argc, char** argv)
    glutInit(&argc, argv);
    glutInitWindowPosition(50, 15);
    glutCreateWindow("OpenGL - The Beginning");


    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    return 0;

The following message occured:
1>main.obj : error LNK2001: unresolved external symbol "__imp____glewShaderSource".
1>main.obj : error LNK2001: unresolved external symbol "__imp____glewCreateShader".

I can't figure out where the error is. I linked to

and think I included all filed I need.
Richard MacCutchan 27-Feb-13 11:10am    
Well I would guess that you have not included all the files you need. Check the documentation to find out what these references are and which library they are in.

Make sure to #define GLEW_STATIC in the project before including GLEW in Windows. Then you can just include the entire source code in your project files. Otherwise, you need to have the proper GLEW DLL file in with your executable.
Share this answer
Sam94 27-Feb-13 15:47pm    
thank you, but there is still a similar error:
error LNK2001: unresolved external symbol "___glewShaderSource".
error LNK2001: unresolved external symbol "___glewCreateShader".
there is only the change that the __imp disappeared.
Just change the command #include into #include <gl\glut.h> and it works. I have encoutered the same problem with many of CUDA programs that use OpenGL.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900