• Advertisement
Sign in to follow this  

OpenGL Setup Issues

This topic is 1802 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

Hello everybody!

I finally decided to jump in and start learning some OpenGL. I am using Code::Blocks and the MinGW compiler. I am also using freeGLUT for windowing, as well as GLEW for the handling of extensions. I am running Windows 7 and my AMD HD 6450 has it's drivers all up to date. I believe the problem I am having is specifically with GLEW. The reason I say this is because I was able to open up a window with freeGlut and everything

was fine and dandy until I tried adding in GLEW

Whenever I try building my project it throws me "undefined reference to ___" errors to several OpenGL functions. The weird part too is for example when it complains about glEnableVertexAttribArray it says:

undefined reference to `_imp___glewEnableVertexAttribArray

Now I'm not too knowledgeable to these things so I tried exercising my Google-fu. Alas my opponent was too strong and I was soundly defeated. The only possible lead I have is that the GLEW lib is not being recognized because the GLEW binaries are not compiled for MinGW, but only for Visual Studio.

Please let me know if you can come up with any solutions, I have been tearing out my hair in frustration at this issue for quite some time now.

As some added information I am following these tutorials on OpenGL codewise:
http://ogldev.atspace.co.uk/index.html

However, I used LazyFoo's tutorials to set up OpenGL on Code::Blocks.

Thank you so much for your help!

-Adrian
 

Share this post


Link to post
Share on other sites
Advertisement

Try compiling glew with mingw using the makefile that comes with the source. You will need to compile it through MSYS because the makefile is not windows-compliant. Then link to your newly compiled library and that should fix things.

Share this post


Link to post
Share on other sites
When you use GLEW, [tt]glEnableVertexAttribArray[/tt] is a macro that expands to [tt]glewEnableVertexAttribArray[/tt], which the compiler/linker know as [tt]_imp___glewEnableVertexAttribArray[/tt] -- hence the weird name.

As to why it doesn't work, there are at least two possible (and luckily easy to check/resolve) reasons:

You may have forgotten to link the library (check project settings in your IDE), or you may have gotten [tt]GLEW_STATIC[/tt] wrong (either have it defined and not using a static lib, or using static but forgotten to define it).

The third possible reason is that the lib you use is not compatible with your linker, but that's unlikely (MinGW normally chews both its own and MSCV's libs just fine).

Share this post


Link to post
Share on other sites

Thanks for your help guys! I'm not very knowledgeable when it comes to compilers and the like, but I was able to do things correctly(finally) on MSVC. This whole library deal is very new to me. I still wasn't able to resolve the problem with Code::Blocks unfortunately :( I will try your suggestions just for curiosity's sake to see if I can fix it, but at least now I have something I can work with.

Thanks!
-Adrian

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement