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:
Hi,
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.

C++
#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()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glutSwapBuffers();
}

static void InitializeGlutCallbacks()
{
    glutDisplayFunc(RenderSceneCB);
}

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);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
    glutInitWindowSize(screenX,screenY);
    glutInitWindowPosition(50, 15);
    glutCreateWindow("OpenGL - The Beginning");

    InitializeGlutCallbacks();

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

    AddShader("vert.VERT-DATEI",GL_VERTEX_SHADER);
    glutMainLoop();
    
    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
C:\GL\lib\glew32.lib
C:\GL\lib\freeglut.lib

and think I included all filed I need.
Posted
Comments
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
 
Comments
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