View Full Version : OpenGL in Visual studio - Issues with GLEW

09-25-2012, 04:04 AM
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 :)

09-27-2012, 03:40 AM
That happens when you don't link with the lib files. You probably did something wrong. Perhaps try the pragma method

09-27-2012, 09:06 AM
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.

09-27-2012, 05:52 PM
@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 :)

@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 :)