OpenGL in Visual studio - Issues with GLEW

Hi all,

I’m currently following the openglbook.com tutorials and have run into an issue fairly early on. I’m getting the following two errors:

1>main.obj : error LNK2019: unresolved external symbol __imp__glewGetErrorString@4 referenced in function _Initialize
1>main.obj : error LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function _Initialize

I have downloaded and compiled freeglut 2.8.0 as well as the glew 1.9.0 binaries. I have copied the libs and includes to C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib and Include respectively.
The Lib and Include paths have also been added to my project properties under additional Additional Library/Include directories.

I have also defined glew32.lib and freeglut.lib in my linker->Input->Additional dependencies.

I have included <GL/glew.h> and <GL/freeglut.h> at the top of my main file.

What am I missing? Every other thread I’ve found has been solved by adding the directories to the project properties. Does anyone have any ideas? ^^

Thanks :slight_smile:

That happens when you don’t link with the lib files. You probably did something wrong. Perhaps try the pragma method
http://www.opengl.org/wiki/FAQ#What_does_Unresolved_External_Symbol_mean.3F

If you’ve just copied the lib files to C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib then I would expect linking to fail. Look in this directory and you’ll see two further subdirectories; one for x86 and one for x64; you should place the libs into the appropriate directory for the platform you’re compiling for (which I assume is x86 in this case).

Doing it this way there is no need to set up any “additional library directories” in your project properties; the SDK directories are automatically set up for you as part of a Visual studio installation.

@V-Man: Is adding the library directory to my “Additional Library Directories” not linking it? I’m trying to avoid the Pragma method (just out of preference), but I’ll give it a go anyway. Thanks :slight_smile:

@Mhagain: I didn’t see any subdirectories (I’ll check again when I get home though). Could it be possible that the sub directories are in Program Files rather than Program Files (x86)?
I am compiling in 32bit. Thanks :slight_smile: