title: unistd.h related difficulty when compiling bison & flex program under vc++
body: <p>I'm using bison &amp; flex (downloaded via cygwin) with vc++. When I compile the program I got an error:</p>
  
  <pre><code>...: fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
  </code></pre>
  
  <p>The corresponding code in the flex-generated file is:</p>
  
  <pre><code>#ifndef YY_NO_UNISTD_H
  /* Special case for "unistd.h", since it is non-ANSI. We include it way
   * down here because we want the user's section 1 to have been scanned first.
   * The user has a chance to override it with an option.
   */
  /* %if-c-only */
  #include &lt;unistd.h&gt;
  /* %endif */
  /* %if-c++-only */
  /* %endif */
  #endif
  </code></pre>
  
  <p>If I define YY_NO_UNISTD_H in the flex file(.l) this error will disappear, but I get several other errors:</p>
  
  <pre><code>...: error C2447: '{' : missing function header (old-style formal list?)
  ...: warning C4018: '&lt;' : signed/unsigned mismatch
  ...: error C3861: 'isatty': identifier not found
  </code></pre>
  
  <p>How can I fix this problem?</p>
  
  <p>All these errors occur in the flex-generated scanner.</p>
  
  <p><strong>I know it's because unistd.h doesn't exist in windows. Do I have to write my own unistd.h? If so how to write it in order to eliminate those errors?</strong></p>