• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1958
  • Last Modified:

variable not in formal parameter list ???

Hello,

On the code below i get continually an error 'gSkel: not in formal parameter list

How can i solve that error ??

Thanks in advance for any help
0
perdoname_
Asked:
perdoname_
  • 2
  • 2
  • 2
1 Solution
 
perdoname_Author Commented:
sorry i forgot to attach the code:

#include "display.h"
 
 
SKELETON* gSkel;			/* Holds skeleton data - available to any function */
MOCAP*	  gMo;				/* Hold motion data - available to any function */
int		  gDelay=0;			/* Holds delay information - available to any function */
 
 
//camera
 
static float   camera_yaw = 0.0f;      
static float   camera_pitch = -20.0f;  
static float   camera_distance = 5.0f; 
 
//mouse
 
static int     drag_mouse_r = 0; 
static int     drag_mouse_l = 0;
static int     drag_mouse_m = 0; 
static int     last_mouse_x, last_mouse_y; 
 
 
static int     win_width, win_height;
 
 
/* Entry point from MAIN.C */
void dorender(int argc, char** argv, SKELETON* skel, MOCAP* mo, int delay) {
 
 
	/* Create GLUT window */
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
   glutInitWindowSize (600, 600);
   glutInitWindowPosition( 0, 0 );
   glutCreateWindow ("Mocap");
 
   /* Setup GLUT callbacks */
   glutReshapeFunc (reshape);
   glutKeyboardFunc (keyboard);
   glutDisplayFunc (display);
   glutMouseFunc( mouse );
   glutMotionFunc( motion );
   glutIdleFunc (idle);
 
   /* Initialise any OpenGL state */
   init();
   initEnvironment();
 
	/* Set global variables */
   gSkel=skel;
   gMo=mo;
   gDelay=delay;
 
   /* Kick off the GLUT main loop */
   glutMainLoop();
   
 
}
 
 
 
void  drawMessage( int line_no, const char * message )
{
	int   i;
	if ( message == NULL )
		return;
 
	glMatrixMode( GL_PROJECTION );
	glPushMatrix();
	glLoadIdentity();
	gluOrtho2D( 0.0, win_width, win_height, 0.0 );
 
	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
	glLoadIdentity();
 
	
	glDisable( GL_DEPTH_TEST );
	glDisable( GL_LIGHTING );
 
	glColor3f( 1.0, 0.0, 0.0 );
	glRasterPos2i( 8, 24 + 18 * line_no );
	for ( i=0; message[i]!='\0'; i++ )
		glutBitmapCharacter( GLUT_BITMAP_HELVETICA_18, message[i] );
 
 
	glEnable( GL_DEPTH_TEST );
	glEnable( GL_LIGHTING );
	glMatrixMode( GL_PROJECTION );
	glPopMatrix();
	glMatrixMode( GL_MODELVIEW );
	glPopMatrix();
}
 
 
/* Keyboard callback from GLUT */
void keyboard(unsigned char key, int x, int y)
{
 
	/* ESCAPE to exit */
	
 
	switch(key) {
 
			case 0x1b:  
						parser_free_skeleton(gSkel);
						parser_free_mocap(gMo);
						exit(0);
						break;
 
 
	}
 
}
 
 
/* Mouse callback from GLUT */ 
void  mouse( int button, int state, int mx, int my )
{
	
	if ( ( button == GLUT_LEFT_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_l = 1;
	
	else if ( ( button == GLUT_LEFT_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_l = 0;
 
	
	if ( ( button == GLUT_RIGHT_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_r = 1;
	
	else if ( ( button == GLUT_RIGHT_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_r = 0;
 
	
	if ( ( button == GLUT_MIDDLE_BUTTON ) && ( state == GLUT_DOWN ) )
		drag_mouse_m = 1;
	
	else if ( ( button == GLUT_MIDDLE_BUTTON ) && ( state == GLUT_UP ) )
		drag_mouse_m = 0;
 
	
	glutPostRedisplay();
 
	
	last_mouse_x = mx;
	last_mouse_y = my;
}
 
 
void  motion( int mx, int my )
{
	if ( drag_mouse_r )
	{
		camera_yaw -= ( mx - last_mouse_x ) * 1.0;
		if ( camera_yaw < 0.0 )
			camera_yaw += 360.0;
		else if ( camera_yaw > 360.0 )
			camera_yaw -= 360.0;
 
		camera_pitch -= ( my - last_mouse_y ) * 1.0;
		if ( camera_pitch < -90.0 )
			camera_pitch = -90.0;
		else if ( camera_pitch > 90.0 )
			camera_pitch = 90.0;
	}
	
	if ( drag_mouse_l )
	{
		
		camera_distance += ( my - last_mouse_y ) * 0.2;
		if ( camera_distance < 2.0 )
			camera_distance = 2.0;
	}
 
	
	last_mouse_x = mx;
	last_mouse_y = my;
 
	glutPostRedisplay();
}
 
 
/* Called back when GLUT idling */
void idle() {
 
}
 
/* Called back by GLUT when the window is resized */
void reshape(int w, int h)
{
 
   glViewport(0, 0, w, h);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   
   gluPerspective(60,(GLfloat)w/(GLfloat)h,0.01,100.0);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
 
   win_width = w;
   win_height = h;
 
}
 
/* Called by us in dorender() to init any OpenGL state */
void init(void)
{  
 
   glClearColor (0.0, 0.0, 0.0, 0.0);
 
}
 
 
 
void  initEnvironment( void )
{
 
	float  light0_position[] = { 10.0, 10.0, 10.0, 1.0 };
	float  light0_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
	float  light0_specular[] = { 1.0, 1.0, 1.0, 1.0 };
	float  light0_ambient[] = { 0.1, 0.1, 0.1, 1.0 };
	glLightfv( GL_LIGHT0, GL_POSITION, light0_position );
	glLightfv( GL_LIGHT0, GL_DIFFUSE, light0_diffuse );
	glLightfv( GL_LIGHT0, GL_SPECULAR, light0_specular );
	glLightfv( GL_LIGHT0, GL_AMBIENT, light0_ambient );
	glEnable( GL_LIGHT0 );
 
	
	glEnable( GL_LIGHTING );
 
	
	glEnable( GL_COLOR_MATERIAL );
 
	
	glEnable( GL_DEPTH_TEST );
 
	
	glCullFace( GL_BACK );
	glEnable( GL_CULL_FACE );
 
	glClearColor( 0.5, 0.5, 0.8, 0.0 );
 
}
 
 
 
 
 
/* Called when GLUT wants to repaint the screen */
void  display( void )
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
 
    glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glTranslatef( 0.0, 0.0, - camera_distance );
	glRotatef( - camera_pitch, 1.0, 0.0, 0.0 );
	glRotatef( - camera_yaw, 0.0, 1.0, 0.0 );
	glTranslatef( 0.0, -0.5, 0.0 );
 
	float  light0_position[] = { 10.0, 10.0, 10.0, 1.0 };
	glLightfv( GL_LIGHT0, GL_POSITION, light0_position );
 
	
	float  size = 1.5f;
	int  num_x = 10, num_z = 10;
	double  ox, oz;
	glBegin( GL_QUADS );
		glNormal3d( 0.0, 1.0, 0.0 );
		ox = -(num_x * size) / 2;
		for ( int x=0; x<num_x; x++, ox+=size )
		{
			oz = -(num_z * size) / 2;
			for ( int z=0; z<num_z; z++, oz+=size )
			{
				if ( ((x + z) % 2) == 0 )
					glColor3f( 1.0, 1.0, 1.0 );
				else
					glColor3f( 0.8, 0.8, 0.8 );
				glVertex3d( ox, 0.0, oz );
				glVertex3d( ox, 0.0, oz+size );
				glVertex3d( ox+size, 0.0, oz+size );
				glVertex3d( ox+size, 0.0, oz );
			}
		}
	glEnd();
   /**********
	*	glColor3f( 1.0f, 0.0f, 0.0f );
	*	if ( asf )
	*		asf->RenderFigure( frame_no, 0.02f );
	*
	*	
	*	char  message[ 64 ];
	*	if ( asf )
	*		sprintf( message, "%.2f (%d)", animation_time, frame_no );
	*	else
	*		sprintf( message, "Press 'L' key to Load ASF/AMC file" );
	*	drawMessage( 0, message );
	*
	*********/
	
    glutSwapBuffers();
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
//neader :
 
 
 
 
#ifdef WIN32
	#include "windows.h"
	#define strcasecmp stricmp
#endif
 
#include "GL/gl.h"
#include "GL/glut.h"
 
#include <math.h>
 
#include "parser.h"
 
void dorender(int argc, char** argv, SKELETON* skel, MOCAP* mo, int delay);
 
/* GLUT callbacks */
void keyboard(unsigned char key, int x, int y);
void reshape(int w, int h);
void init(void);
void initEnvironment(void);
void display(void);
void idle(void);
void mouse(int button, int state, int mx, int my )
 
#endif

Open in new window

0
 
sunnycoderCommented:
which compiler/platform? Can you give exact error message and point out the line at which it is indicating the error ... normally this error is seen on old C function definitions where parameter types were declared after function signature.
0
 
Infinity08Commented:
In your header file, you are missing a ; after the mouse function signature :

>>         void mouse(int button, int state, int mx, int my )

Check for other similar errors if you keep getting similar error messages.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sunnycoderCommented:
good catch I08
0
 
Infinity08Commented:
K&R style function parameters cause a lot of difficult to pinpoint errors (like this one).
0
 
perdoname_Author Commented:
can you please check that question as well?
http://www.experts-exchange.com/Programming/Languages/C/Q_23895549.html

thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now