title: Premature end of script headers: C++ cgi
body: <p>I hope somebody can help me with this HelloWorld CGI  C++ program.
  I'm running a Xamp server on localhost and I compiled this code in the cgi-bin folder inside /xamp.
  The file name is _1.exe</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char** argv) {
      cout &lt;&lt;"Content-Type: text/html\n\n";                                       
  
      cout &lt;&lt; "&lt;?xml version = \"1.0\" encoding=\"ISO-8859-1\"?&gt;" &lt;&lt;endl;          
      cout &lt;&lt;"&lt;!DOCTYPE html Public \"-//W3C//DTD XHTML 1.1//EN\" "&lt;&lt;endl;
      cout &lt;&lt; " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"&gt;"&lt;&lt;endl;
  
      cout &lt;&lt;"&lt;html xmlns = \"http://www.w3.org.1999/xhtml\lang=\"en\" xml:lang=\"en\"\"&gt;"&lt;&lt;endl;
      cout &lt;&lt;"&lt;head&gt;&lt;title&gt;Helloworld&lt;/title&gt;&lt;/head&gt;"&lt;&lt;endl;                          
  
      cout &lt;&lt;"&lt;body&gt;&lt;h1&gt;Hello world!!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
      return 0;
  }
  </code></pre>
  
  <p>The executable runs from windows but if I call it from the server I get this:</p>
  
  <pre><code>Error message:
  Premature end of script headers: _1.exe 
  </code></pre>
  
  <p>I am compiling with Netbeans and cygwin tools.</p>
  
  <p>I tried also to rename the file  _1.cgi</p>