Jump to content

  • Log In with Google      Sign In   
  • Create Account


OpenGL Setup Issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 SharkBaitHooHaHa   Members   -  Reputation: 271

Like
0Likes
Like

Posted 10 February 2013 - 10:40 PM

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
 



Sponsor:

#2 kidman171   Members   -  Reputation: 493

Like
1Likes
Like

Posted 11 February 2013 - 03:33 AM

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.



#3 samoth   Crossbones+   -  Reputation: 4064

Like
1Likes
Like

Posted 11 February 2013 - 04:05 AM

When you use GLEW, glEnableVertexAttribArray is a macro that expands to glewEnableVertexAttribArray, which the compiler/linker know as _imp___glewEnableVertexAttribArray -- 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 GLEW_STATIC 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).

#4 SharkBaitHooHaHa   Members   -  Reputation: 271

Like
0Likes
Like

Posted 11 February 2013 - 08:50 PM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS