title: Trying to create a thread to send a message to a socket. Getting 2 errors having to do with thread constructor
body: <p>I am trying to create a thread in order to send a message to an open socket. I am gettings 2 specific errors.</p>
  
  <blockquote>
    <p>E0289: No instance of constructor "std::thread::thread" matches the argument list.</p>
    
    <p>C2661: 'std::thread::thread' no overloaded function takes 2 arguments**</p>
  </blockquote>
  
  <p>I have found similar posts about this but still cannot quite figure it out could really use some clarification.</p>
  
  <pre><code>#include &lt;WS2tcpip.h&gt;
  #include &lt;string&gt;
  #include &lt;thread&gt;
  
  using namespace std;
  
  #pragma comment (lib, "ws2_32.lib")
  
  void SendMessage(string message)
  {
      WSAData data;
      WORD version = MAKEWORD(2, 2);
      int wsOk = WSAStartup(version, &amp;data);
      if (wsOk != 0)
      {
          cout &lt;&lt; "Failed, Error Code: " &lt;&lt; WSAGetLastError() &lt;&lt; endl;
      }
  
      sockaddr_in user;
      user.sin_family = AF_INET;
      user.sin_port = htons(3514);
      inet_pton(AF_INET, "127.0.0.1", &amp;user.sin_addr);
  
      SOCKET out = socket(AF_INET, SOCK_DGRAM, 0);
  
      int sendMsg = sendto(out, message.c_str(), message.size() + 1, 0, (sockaddr*)&amp;user, sizeof(user));
  
      if (sendMsg == SOCKET_ERROR)
      {
          cout &lt;&lt; "Failed, Error: " &lt;&lt; WSAGetLastError() &lt;&lt; endl;
      }
  
      closesocket(out);
      WSACleanup();
  }
  
  int main()
  {
      string message = "";
      cout &lt;&lt; "Enter a message to send: ";
      cin &gt;&gt; message;
  
      thread sendtoSocket (SendMessage, message);
  
      sendtoSocket.join();
  
      system("pause");
      return 0;
  }
  </code></pre>