title: C++ Constructor with string
body: <p>I am trying to get a constructor to accept string, and failing.</p>
  <p>To simplify it, I brought my code to a bare minimum..
  My code is as follows:</p>
  <p><strong>file: TestClass.h</strong></p>
  <pre><code>#ifndef __TestClass_H__
  #define __TestClass_H__
  
  #include &lt;string.h&gt;
  using namespace std;
  
  class TestClass
  {
      public:
          TestClass(string TSTStr);
  };
  
  #endif /* __TestClass_H__ */
  </code></pre>
  <p><strong>file: TestClass.cpp</strong></p>
  <pre><code>#include &quot;TestClass.h&quot;
  
  TestClass::TestClass(string TSTStr) 
  {
  }
  </code></pre>
  <p>And my main code simply has...</p>
  <pre><code>#include &quot;TestClass.h&quot;
  #include &lt;string&gt;
  using namespace std;
  
  string TestString = &quot;test&quot;;
  TestClass TC1(TestString);
  </code></pre>
  <p>Yet, when I try to compile, I get the following error:</p>
  <pre><code>In file included from src\main.cpp:28:
  lib/TestClass/src/TestClass.h:10:19: error: expected ')' before 'TSTStr'
     TestClass(string TSTStr);
              ~      ^~~~~~~
                     )
  src\main.cpp: In function 'void app_main_JSON()':
  src\main.cpp:113:26: error: no matching function for call to 'TestClass::TestClass(std::__cxx11::string&amp;)'
    TestClass TC1(TestString);
                            ^
  In file included from src\main.cpp:28:
  lib/TestClass/src/TestClass.h:7:7: note: candidate: 'constexpr TestClass::TestClass()'
   class TestClass
         ^~~~~~~~~
  lib/TestClass/src/TestClass.h:7:7: note:   candidate expects 0 arguments, 1 provided
  lib/TestClass/src/TestClass.h:7:7: note: candidate: 'constexpr TestClass::TestClass(const TestClass&amp;)'
  lib/TestClass/src/TestClass.h:7:7: note:   no known conversion for argument 1 from 'std::__cxx11::string' {aka 'std::__cxx11::basic_string&lt;char&gt;'} to 'const TestClass&amp;'
  lib/TestClass/src/TestClass.h:7:7: note: candidate: 'constexpr TestClass::TestClass(TestClass&amp;&amp;)'
  lib/TestClass/src/TestClass.h:7:7: note:   no known conversion for argument 1 from 'std::__cxx11::string' {aka 'std::__cxx11::basic_string&lt;char&gt;'} to 'TestClass&amp;&amp;'
  </code></pre>
  <p>I am following a sample code I've found here, which works : <a href="https://www.w3schools.com/cpp/cpp_constructors.asp" rel="nofollow noreferrer">https://www.w3schools.com/cpp/cpp_constructors.asp</a></p>
  <p>I'm not sure what I'm doing wrong :/</p>
  <p>Note: I am using platformio over VSCode.</p>