PDA

View Full Version : Undeclared Identifier..please help



shehz
09-16-2001, 03:05 PM
I'm facing different errors..why am I getting it?..this is the main function of my code..How can I declare it?

void main ( int argc, char **argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE);
glutInitWindowPosition (100, 100);
glutInitWindowSize( 800, 600);
glutCreateWindow( "hello world") ;
glutDisplayFunc( renderScene );
glutIdleFunc( renderScene);
glutKeyboardFunc ( keyboardInput);
glutMainLoop();
}

ERRORS
u:\prot\triangle.cpp(47) : error C2065: 'BGL_DEPTH' : undeclared identifier
u:\prot\triangle.cpp(47) : error C2065: 'BGL_RGB' : undeclared identifier
u:\prot\triangle.cpp(47) : error C2065: 'BGL_DOUBLE' : undeclared identifier


[This message has been edited by shehz (edited 09-16-2001).]

john
09-16-2001, 03:20 PM
<blinks> are you sure you're even compiling _that_ program? Firstly, there aren't >= 47 lines in that source, and secondly, the symbols the compiler is talking about isn't referenced at all.

I *think* you've copied some borland project file and have decided to edit one file of the project and then rrebuilding it =) Er, in which case, that's not good. Your best bet is to make a new project and cut and paste the soruce you haev given above into it. (Incidentially, I'm only ~guessing~ its a Borland compiler. I vaguely remember some Borland Graphics Interface / Library thing from my BCC 3.1 compiler waaaaay back in DOS days.)

cheers,
John

shehz
09-16-2001, 03:25 PM
I'm working in Visual C++

Oh no I just pasted part of my program ..where the errors are.. let me paste my full code here


#include "windows.h"
#include "glut.h"
#include <stdlib.h>
#include <math.h>

static const char * const APP_NAME = "glut Test 1";
static const char APP_KEY_QUIT = 'q';

void renderScene()
{
static float angle = 0.0f;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glColor3f(1.0f, 0.0f, 0.0f );

glRotatef( angle, 0.0, 1.0, 0.0 );
glBegin ( GL_TRIANGLES ) ;
glVertex3f( -0.5, -0.5, 0.0 );
glVertex3f(0.0, 0.5, 0.0 );
glVertex3f(0.5, -0.5, 0.0 );
glEnd();

glPopMatrix();
glFlush();
glutSwapBuffers();
angle +=1.0f;

if (angle > 360.0f )
angle += fmod( angle, 360.0f);

}

void keyboardInput( unsigned char key, int x, int y )
{
switch (tolower(key))
{
case APP_KEY_QUIT:
exit(0);
break;
}
}

void main ( int argc, char **argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition (100, 100);
glutInitWindowSize( 800, 600);
glutCreateWindow( "hello world") ;
glutDisplayFunc( renderScene );
glutIdleFunc( renderScene);
glutKeyboardFunc ( keyboardInput);
glutMainLoop();

}

THESE are the errors I get
ERRORS
u:\prot\triangle.cpp(47) : error C2065: 'BGL_DEPTH' : undeclared identifier
u:\prot\triangle.cpp(47) : error C2065: 'BGL_RGB' : undeclared identifier
u:\prot\triangle.cpp(47) : error C2065: 'BGL_DOUBLE' : undeclared identifier




[This message has been edited by shehz (edited 09-16-2001).]

ByteZero
09-16-2001, 09:36 PM
Okay i try your code and what sould i say it works http://www.opengl.org/discussion_boards/ubb/biggrin.gif

tip: copy the glut.h to the VC98\Include\GL Directory.

And write in to your code #include<GL/glut.h>
compile the code and you can see there is no error in your code

c u