1
votes

Im getting the following link error. 1>main.obj : error LNK2001: unresolved external symbol ___glewGenBuffers

I downloaded the 32bit version of glew and included the "includes" and "lib" directory in the project. Also i added the glew32.lib in the additional dependencies menu. Then I placed the glew32.dll and glew32mx.dll in the syswow64 folder and also in system32 folder(since i still got the error when i placed it in syswow64). It fairly a simple program. Like hello world to opengl with SDL and GLEW. The program worked when with just SDL setup. After linking glew, started the problem.

I'm using Windows 7 Premium 64bit(quite obvious by now) Visual C++ 2010 express edition. My version of glew is glew-1.9.0-win32.

Where might I be going wrong?

here is the code

#define GLEW_STATIC
#include <SDL.h>
#include <GL/glew.h>

int main( int argc, char *argv[] )
{
    glewExperimental = GL_TRUE;

SDL_Init( SDL_INIT_VIDEO );

SDL_Surface* surface = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_OPENGL);
SDL_WM_SetCaption("Opengl Tutorial 1", 0);


glewInit();

GLuint vertexBuffer;
glGenBuffers( 1, &vertexBuffer );
printf( "%u\n", vertexBuffer );

SDL_Event windowEvent;
while ( true )
{
    if ( SDL_PollEvent( &windowEvent ) )
    {
        if ( windowEvent.type == SDL_QUIT ) break;
        if ( (windowEvent.type == SDL_KEYUP) && (windowEvent.key.keysym.sym == SDLK_ESCAPE) ) break;
    }

    SDL_GL_SwapBuffers();
}

SDL_Quit();
return 0;
}
1
Have you linked to the .lib files in the properties of your project?Tony The Lion
@TonyTheLion under the linker->input->Additional dependencies u say? indeed i did. glew32.lib it is.jaykumarark
yes of course. it was already done.jaykumarark
possible duplicate of linking to glew in cNicol Bolas

1 Answers

2
votes

I solved the issue. I just wrote this line "#define GLEW_STATIC" (w/o " of course) after the include statements and it compiled immediately. Thanks anyways. :)