Jump to content
  • Advertisement
Sign in to follow this  
Huskey

OpenGL Help: OpenGL on VC6 and VS2005

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

Hi! My problem actually concenrs Visual C++ 6.0 and Visual Studio 2005. While rewriting some of NeHe's OpenGL tutorials in my way (i split the code into .h and .cpp etc.) I encountered a problem. While using a line like this in the header-file, inside a class: class CGLWindow{ public: (...) const GLfloat LightAmbient[] = { 0.5f , 0.5f , 0.5f , 1.0f }; (...) }; i experience some errors: (...)\glwindow.h(43) : error C2059: syntax error : '{' (...)\glwindow.h(43) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body It wont work both on VC6 nor VS2005, and I was sure that code should work. If anyone could help me out, I would be grateful! Best regards, Krzysztof Koch

Share this post


Link to post
Share on other sites
Advertisement
What are you expecting of that code? Are you expecting it to be a static so that you can access it as CGLWindow::LightAmbient, or do you just want LightAmbient to be initialized upon construction. If it's the former you should make it const static, and move the definition outside the declaration of the class. If it's the latter you should just do:
const GLfloat LightAmbient[4];

And initialize it in your constructor.

Share this post


Link to post
Share on other sites
First of all: thanks for your answer.

I know I could do it like you proposed, but it would be a little bit... long :) This part of the code is just to set the light that I was going to use in my code:

glLightfv(GL_LIGHT1 , GL_AMBIENT , LightAmbient);

I don't know wheather it's the answer to your question. Anyway - I think I will just do as you suggested. Now I encountered another problem :(

GLWindow.obj : error LNK2019: unresolved external symbol _auxDIBImageLoadA@4 referenced in function "public: struct _AUX_RGBImageRec * __thiscall CGLWindow::LoadBMP(char *)" (?LoadBMP@CGLWindow@@QAEPAU_AUX_RGBImageRec@@PAD@Z)

what does that mean? Help please! It's weird, because the same code WOULD work underVisual C++ 6.0 ....

Best regards,

Huskey

EDIT: I just changed my code to initialize everything in my constructor. But the second problem still occures :( (the one with "unresolved external symbol".
It's my first time I use VS2005 so please.. be patient :)

[Edited by - Huskey on September 6, 2006 12:30:24 PM]

Share this post


Link to post
Share on other sites
Quote:
GLWindow.obj : error LNK2019: unresolved external symbol _auxDIBImageLoadA@4 referenced in function "public: struct _AUX_RGBImageRec * __thiscall CGLWindow::LoadBMP(char *)" (?LoadBMP@CGLWindow@@QAEPAU_AUX_RGBImageRec@@PAD@Z)


Unresolved external symbol means that the definition of some function/class can't be found, often you have forgotten to link with some .lib file. In this case we are talking about auxDIBImageLoad which my Google search tells me comes from glaux.lib, have you remembered to link with glaux.lib? And are you sure it's the right version?

Share this post


Link to post
Share on other sites
Quote:
Are you expecting it to be a static so that you can access it as CGLWindow::LightAmbient, ...[then] you should make it const static, and move the definition outside the declaration of the class


You can initialize a static const variable inside a class definition

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!