0

Recently I learned that functions such as glGenerateMipmap() on the OpenGL API need to be loaded by specific OS. GLEW is a wrapper which is supposed to do the work for you for this very purpose. And so I added GLEW to my project. However, when I compile the function in my code, it gives the error:

undefined reference to `_imp____glewGenerateMipmap'|

I thought this would be a linker error but ever other gl functions so far works fine. In fact, I have been working on this OpenGL project for a while with no linker errors. Could this be a bug? Using Codeblocks, Windows 7 64 bit.

sgtHale
  • 1,507
  • 1
  • 16
  • 28
  • Looks like [this Q&A](http://stackoverflow.com/questions/7549594/opengl-glew-mingw-application-linking-issue) has a solution for your problem. The setup of the development environment is very similar to yours, it seems. – πάντα ῥεῖ Jul 26 '14 at 10:13
  • GLEW is so small that I like to bundle it's source in my projects. My main working platform is Linux, so I never get what is going on MinGW or Visual Studio, so, bundling the source code solves the problems with linking errors I always get. – André Puel Jul 26 '14 at 20:43

1 Answers1

2

1.)Please make sure you have the latest version of Glew as can be found here : GLEW webpage

That been said, I do wish to highlight that it means, including the latest header file in your project as well as linking your project against the latest GLEW library version.

The reason why i think that your GLEW library/headers are outdated is because you wrote :

I thought this would be a linker error but ever other gl functions so far works fine.

However, If you got by only using the default outdated GL , It only covers the functionality in the first draft of openGL which is version 1.1 in most cases, The first draft doesn't cover extensions and later versions of OpenGL.

2.)Link : how to link correctly under CodeBlocks : How to link under codeblocks

Community
  • 1
  • 1
Illasera
  • 90
  • 9
  • Well this helped me solve my problem. The problem was that everytime I used glew, I did a define GLEW_STATIC in every include. So I accidentally left out 1 include glew.h that did not have the preprocessor before it and it screwed the whole thing up. Instead I just put the GLEW_STATIC inside the glew.h and now everything works. – sgtHale Jul 26 '14 at 21:00