title: simple tcp echo program not working when SDL included?
body: <p>I have this weird problem where whenever I <code>#include "SDL/SDL.h"</code>, my windows socket program doesn't execute. It compiles but it doesn't do anything when run. When I remove the <code>#include "SDL/SDL.h"</code> header, compile and run, it starts working again??.</p>
  
  <p>I'm trying to make both SDL and my original socket program work but I don't understand whats wrong this.</p>
  
  <pre><code>//#include "SDL/SDL.h"
  #define _WIN32_WINNT 0x501
  #include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  #include &lt;winsock2.h&gt;
  #include &lt;ws2tcpip.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ws2tcpip.h&gt;
  #define MAXLEN 80
  using namespace std;
  
  const int winsockVersion = 2;
  
  int main( int argc, char* args[] ) { 
  
      WSADATA wsadata;
      if ( (WSAStartup(MAKEWORD(2,0),&amp;wsadata)) == 0){
          cout&lt;&lt;"-[ WSAStartup Initialized. ]" &lt;&lt; endl;
  
          char PORT[MAXLEN];
          char SERVER[MAXLEN];
          cout &lt;&lt;"Server: ";
          cin&gt;&gt;SERVER;
          cout &lt;&lt;"Port: ";
          cin&gt;&gt;PORT;
  
          struct addrinfo hints, *res;
          int sockfd;
  
          memset(&amp;hints,0,sizeof hints);
          hints.ai_family = AF_UNSPEC;
          hints.ai_socktype = SOCK_STREAM;
  
          if (getaddrinfo(SERVER,PORT,&amp;hints,&amp;res) != 0){
              cout&lt;&lt;"-Getaddrinfo unsuccessful." &lt;&lt; endl;
          }
  
          if ( (sockfd = socket(res-&gt;ai_family,res-&gt;ai_socktype,res-&gt;ai_protocol)) == -1 ){
              cout&lt;&lt;"-Unable to create socket." &lt;&lt; endl;
          }
  
          if ( (connect(sockfd,res-&gt;ai_addr,res-&gt;ai_addrlen)) != -1 ){
              cout&lt;&lt;"-[ Connection Established. ]" &lt;&lt; endl;
          }
  
          cout&lt;&lt;"-[ Client connecting to: ]" &lt;&lt; res-&gt;ai_addr &lt;&lt; endl;
  
          while(true){
              string text_buff;
              cout&lt;&lt;"Send: ";
              getline(cin,text_buff);
              if( (send(sockfd,text_buff.c_str(),text_buff.length()+1,0)) != -1 ){
                  cout&lt;&lt;"-----------------------------------&gt; Data sent!." &lt;&lt; endl;
              }
  
              if ( text_buff == "quit" ){
                  break;
              }
  
          }
  
      }else{
          cout&lt;&lt;"-WSAStartup Initialization failed." &lt;&lt; endl;
          if(WSACleanup()!=0){
              cout&lt;&lt;"-WSACleanup Successful." &lt;&lt; endl;
          }else{
              cout&lt;&lt;"-WSACleanup Failed." &lt;&lt; endl;
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>compiling with </p>
  
  <pre><code>g++ -o draft.exe draft.cpp -I"C:\compilers and libs\Libs\SDL\SDL devep\SDL-1.2.15\include" -L"C:\compilers and libs\Libs\SDL\SDL devep\SDL-1.2.15\lib" -lmingw32 -lSDLmain -lSDL -lws2_32
  </code></pre>