# 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.

## 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 on other sites
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 on other sites

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 :(

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 on other sites
Quote:

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 on other sites
Thx a lot! Yeah - i forgot to add glaux.lib. Thx again!

Best regards,

Huskey

##### 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

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 11
• 14
• 10
• 25
• ### Forum Statistics

• Total Topics
632651
• Total Posts
3007657
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!