'Variable' was not declared in this scope
What is the reason of this error ? 
my code is : 

    bool QP(char A[],int n)  //delete duplicate 
    {
       for(int i=0;i<n-1;i++)
        { 
            if(A[i+1]==A[i])
               return false;
        }
       return true;
    }
    
    void Writeword(char* word)
    {
      if(QP(currentword,strlen(currentword)))
        {
         fprintf(fp, "%s\n", currentword);
         charswritten += strlen(word) + 2;
         Processbar();
        } 
    }

and when i want to compiling its give me the error: Writeword(char*)': wordgen.cpp:79:9: error: 'currentword' was not declared in this scope 
. I use g++ for compiling . 
I can’t figure out why ? its declared in QP function . 
'Variable' was not declared in this scope
===

What is the reason of this error ? 
my code is : 

    bool QP(char A[],int n)  //delete duplicate 
    {
       for(int i=0;i<n-1;i++)
        { 
            if(A[i+1]==A[i])
               return false;
        }
       return true;
    }
    
    void Writeword(char* word)
    {
      if(QP(currentword,strlen(currentword)))
        {
         fprintf(fp, "%s\n", currentword);
         charswritten += strlen(word) + 2;
         Processbar();
        } 
    }

and when i want to compiling its give me the error: Writeword(char*)': wordgen.cpp:79:9: error: 'currentword' was not declared in this scope 
. I use g++ for compiling . 
I can’t figure out why ? its declared in QP function . 