View Full Version : A small problem
Kronos259
05-28-2003, 02:42 AM
I use
void draw(){
//here i draw a cube starting with glbegin
//finishing with glEnd;
}
When i compile the program i get the message "Local functions are illegal".
Anyone knows why?
Allan Walton
05-28-2003, 02:51 AM
It's because it's inside another function.
check the position of the '{' and '}' around it. my guess is that you've removed an if statement or other large code section that uses '{' and '}' and there's a mismatch...
Allan
Kronos259
05-28-2003, 03:21 AM
That code is right after the following(i have drawn nothing before it so there is no way it could be messed with other functions)
int DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity();
Allan Walton
05-28-2003, 03:53 AM
you are trying to declare draw() inside int DrawGLScene:
int DrawGLScene()
{
void Draw() // This is a local function definition and illegal...
{
}
}
you need to write it as:
void Draw()
{
}
int DrawGLScene()
{
Draw();
}
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.