title: strcmp cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*
body: <p>Apologies in advance for the elementary nature of the question.</p>
  
  <p>I am trying to use the <code>strcmp</code> function to test two strings for matching characters.</p>
  
  <p>I reduced the issue to the simple code below:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt; 
  
  using namespace std;
  
  void compareStrings(string, string);
  
  int main()
  {
      string string1 = "testString", string2 = "testString";
      compareStrings(string1, string2);
      return 0;
  }
  
  void compareStrings(string stringOne, string stringTwo)
  {
      if (strcmp(stringOne,stringTwo) == 0)
          cout &lt;&lt; "The strings match." &lt;&lt; endl;
      else 
          cout &lt;&lt; "The strings don't match." &lt;&lt; endl;
  }
  </code></pre>
  
  <p>Could someone explain the following compiler error message?</p>
  
  <pre class="lang-none prettyprint-override"><code>./newProgram.cpp: In function ‘void compareStrings(std::string, std::string)’:
  ./newProgram.cpp:17:32: error: cannot convert ‘std::string {aka std::basic_string&lt;char&gt;}’ to ‘const char*’ for argument ‘1’ to ‘int strcmp(const char*, const char*)’
    if (strcmp(stringOne,stringTwo) == 0)
                                  ^
  </code></pre>
  
  <p>Thanks!
  Xz.</p>