Programming   Help! GLEW compiles but doesn’t link!

Help! GLEW compiles but doesn’t link!

When you compile the glew_static project from glew on Visual Studio and link it with your program, you may get something like this:

app_init.obj : error LNK2001: unresolved external symbol __imp__glewInit
worldscene.obj : error LNK2001: unresolved external symbol __imp____glewBufferSubData
worldscene.obj : error LNK2001: unresolved external symbol __imp____glewBufferData
worldscene.obj : error LNK2001: unresolved external symbol __imp____glewBindBuffer
worldscene.obj : error LNK2001: unresolved external symbol __imp____glewGenBuffers

It’s easy to fix. Just add GLEW_STATIC to the preprocessor definitions and you’re done. This is because without it the header specifies dllimport instead of just extern, which is needed for static linkage.

No Comments - Leave a comment

Leave a comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>