Compiler Error C2601

'function name' : local function definitions are illegal

An attempt was made to define a function within a function.

The following is an example that will generate this error:

int main()
{
   int i = 0;

   int funcname(int j)
   {
      j++;
      return j;
   }
   
   i = funcname(i);
   return 0;
}

If you move the function into the global space, outside the main() function, the program will compile and run.