PDA

View Full Version : Glew 1.7.0 - unresolved external symbol glewInit()



swethasharma
01-13-2012, 09:03 PM
Hi,

I am woring on window 7(64bit) with Intel graphics 3000.I have installed glew1.7.0.

I have installed as per the directions in glew website.

glew32.dll in system32 folder.

glew32.lib in C:\ProgramFiles\MicrosoftSDKs\Windows\v6.0A\lib
glew.h and wglew.h in C:\ProgramFiles\MicrosoftSDKs\Windows\v6.0A\Includ e\GL



#include<stdio.h>
#define GLEW_STATIC
#include<gl/glew.h>
void main()
{
int i;
i=glewInit();

}


I am getting a linker error
unresolved external symbol _glewInit referenced in function _main

How do i solve this?

Alfonse Reinheart
01-13-2012, 10:29 PM
Did you actually link with the glew32.lib library?

swethasharma
01-14-2012, 07:13 AM
Hi,

I have linked to glew32.lib.Linker->Input->Additional Dependencies ,in additional dependencies i have given the path to the glew32.lib file.

thokra
01-16-2012, 07:04 AM
I never tried what you did but I think you're supposed to provide the MSVC compiler with the search paths in Linker->General->Additional Library Directories and only put "glew32.lib" in Additional Dependencies.

I think your linker is trying to find a file named with the complete path which isn't going to work.

swethasharma
01-17-2012, 07:23 AM
Hello,

I solved the problem.Actually i had downloaded glew 64 bit version.I downloaded the 32 bit version it worked.
Thankyou very much for your support.

vreal
02-02-2012, 09:27 AM
I have a similar problem. I use Visual Studio 2010 and I can't make it link glew statically.

I include glew.h at first position
#include <GL/glew.h>
from the correct folder
and add the according properties:
C/C++ / General / Additional Include Directories
..\GL\glew\include;

C/C++ / General / Preprocessor
GLEW_STATIC

Linker / General / Additional Include Directories
..\GL\glew\lib;

I get a lot of LNK2001 errors:
e.g.
Error 4 error LNK2001: unresolved external symbol ___glewBindBuffer <<path>>\OpenGLTest.obj

Dynamic linking works. When I remove the preprocessor directive and put glew32.dll to the exe folder it works. But I want to link it statically.

I hope anybody can help me.

Alfonse Reinheart
02-02-2012, 11:11 AM
When I remove the preprocessor directive and put glew32.dll to the exe folder it works.

That shouldn't be possible. The static version of GLEW (which I assume you built) is not the same library as the import library version of GLEW.

So if this is happening, it is because you're still linking to the import library, not the static library. It's a bit confusing since they both have the ".lib" suffix. But they're different libraries with different symbols in them.

vreal
02-02-2012, 11:28 AM
Thank you for the fast response.
Yes, I indeed was using glew32.lib instead of glew32s.lib.