Error: local function definitions are illegal!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaygee
    New Member
    • Feb 2007
    • 12

    Error: local function definitions are illegal!

    Hi ppl can anyone tell me what this error means?
    error C2601: 'meanData' : local function definitions are illegal
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by kaygee
    Hi ppl can anyone tell me what this error means?
    error C2601: 'meanData' : local function definitions are illegal
    it happens when you try to define a function within a function, see
    http://msdn2.microsoft .com/en-us/library/sba3hty9.aspx

    e.g. I try to define function meandata() within function fg1()
    Code:
    int fg1()
    {
         int meanData() { return 1; }
         int j=meanData();
         return j;
    }
    when I compile it using Visual C I get the error message
    m.cpp(5) : error C2601: 'meanData' : local function definitions are illegal

    define it outside fg1()
    Code:
    int meanData() { return 1; }
    
    int fg1()
    {
         int j=meanData();
         return j;
    }

    Comment

    Working...