Can not include glew.h in multiple files within the same project.

Recommended Posts

Not a graphics question per se, but I'm having a hell of a time just getting glew to work. See, I had a project using glew.h as well as other files like SDL_Opengl and glm all contained within main.cpp which I compiled and ran just fine. But now I want to split my project up into more files. The problem is if I include glew.h in one of my header files as well as in my main.cpp I get "multiple definition" errors. If I only include it in one or the other, then I get "function undefined" errors. I have tried including GLEW_STATIC and it seems to have done nothing. I also tried putting all my OpenGL header includes in a separate header file with it's own header locks and #pragma once calls and it still didn't work.

Share this post


Link to post
Share on other sites

If you included glew.h in main.cpp before including the header that defines GLEW_STATIC, then that might have caused it, since it wouldn't have been defined for when main.cpp included glew. Or it could have been the other way around. It could also have been a dependency loop, one header includes a header that includes the first one.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now