Click here to Skip to main content
13,046,464 members (72,836 online)
Rate this:
Please Sign up or sign in to vote.
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.
Posted 27-Feb-13 5:04am
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100