title: Not declared in this scope error for function
body: <p>I'm trying to define a function in a class and then use it in a .cpp program. I have declared the function above main and can't figure out why I'm getting a not declared in scope error.</p>
  
  <p>Error from g++: "error: ‘convert’ was not declared in this scope"</p>
  
  <p>Thanks in advance.</p>
  
  <p>A.h:</p>
  
  <pre><code>class A
  {
      public:
  
          int convert(char bcd);
  
  };
  </code></pre>
  
  <p>program.cpp:</p>
  
  <pre><code>#include "A.h"
  #include &lt;iostream&gt;
  #include&lt;stdio.h&gt;
  
  using namespace std;
  
  
  int A::convert(char b)
  {
      return b*5;
  }
  
  int main(){
  
      char myword = '27'; 
      char cc = convert(myword); //scope error here
      cout &lt;&lt; "Number is: " &lt;&lt; cc &lt;&lt; endl;
  
     return 0;
  }
  </code></pre>