title: Compile error C++
body: <p>I am new in C++. When I compile this code compiler reports error-</p>
  
  <p>main.cpp-</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "main.h"
  
  using namespace std;
  
  string strings::getstr(string str)
  {
      return str;
  }
  
  int main()
  {
      strings strstr;
      string constr;
      string msg;
  
      msg = "Hello World!";
      constr = strstr.getstr(msg);
      cout &lt;&lt; constr;
      return 0;
  }
  </code></pre>
  
  <p>main.h-</p>
  
  <pre><code>#ifndef MAIN_H_INCLUDED
  #define MAIN_H_INCLUDED
  
  #include &lt;string&gt;
  
  class strings
  {
  public:
      string getstr (string str);
  };
  
  #endif // MAIN_H_INCLUDED
  </code></pre>
  
  <p>error-</p>
  
  <pre><code>error: 'string' does not name a type
  error: no 'std::string strings::getstr(std::string)' member function declared in class 'strings'
  error: In function 'int main()':
  error: 'class strings' has no member named 'getstr'
  </code></pre>
  
  <p>I am using Code::Blocks and gcc
  I have written this simple code because I am working on a project and when I want to compile I always getting </p>
  
  <blockquote>
    <p>'string' does not name a type</p>
  </blockquote>
  
  <p>sorry for bad english...</p>