Jump to content
  • Advertisement
Syerjchep

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

This topic is 458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

I believe I solved this problem.

I got the newest version of GLEW and included the glew.c file directly in my project rather than trying to link to it.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!