Ok, this makes no sense. I have this function for example:
void func1(int, int); //prototype
void func1(int y, int z)
{ //This is the line of the error
blah blah, all this stuff
}
What the heck does that mean?
This is a discussion on Local function definitions are illegal!? within the C++ Programming forums, part of the General Programming Boards category; Ok, this makes no sense. I have this function for example: void func1(int, int); //prototype void func1(int y, int z) ...
Ok, this makes no sense. I have this function for example:
void func1(int, int); //prototype
void func1(int y, int z)
{ //This is the line of the error
blah blah, all this stuff
}
What the heck does that mean?
It probably means you've tried to define your function from within another function. Function definitions either need to be global or inlined in class declarations.
zen
This error crops up as the answer to missing closing curly braces (}). Usually the function that is causing the error is not intended to be defined locally (i.e. inside another function) ... the problem typically lies in the previous function which forgets a closing curly brace somewhere. The following would cause this error:
void func1(int a)
{
if (a > 10)
{
cout << "a > 10" << endl;
}
void func2(int b)
{ // will get error here
}