Alright guys, I have a really weird error here. I'm programming a program that lets you specify the red, green, and blue components then stores them in arrays and uses the colors when drawing shapes. The program worked perfectly until about five minutes ago. Nothing affecting that specific part of the code was changed. I just added a function that deals with the simulation of a turn of a rubik's cube. So anyway, I'm using OpenGL with c++. I'm on Windows XP Sp. 3. I'm using Microsoft Visual Studio 2008 Express Edition. Here's the error and code:

int r[54];
int b[54];
int g[54];

// here are three arrays. The error only appears on the "b" , or blue, // array.

// Here is how the code is being accessed: glColor3f(r[0],g[0],b[0]);

// the error: error C2040: 'b' : 'int [54]' differs in levels of indirection // from 'int'
// the error appears on the line of: int b[54];

Thanks a lot! I have no idea what this is all about.

Recommended Answers

All 3 Replies

Is there another variable named "b" ? Show more code.

What is the signature of this function? glColor3f is this a function you have specified yourself? If so it seems as though the function is expecting an int where you have provided an array. Did you forget a '*'?

What is the signature of this function? glColor3f is this a function you have specified yourself? If so it seems as though the function is expecting an int where you have provided an array. Did you forget a '*'?

nope. glColor3f is the API's function. He needs to show more code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.