title: How to hide the console window of a C program?
body: <p>I've been looking around but I couldn't find the solution to my problem, even with some supposedly solved problems that resemble mine.</p>
  
  <p>I want to hide the console window when my C program runs.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;windows.h&gt;
  #define _WIN32_WINNT 0x0500
  
  int main(){   
      HWND hWnd = GetConsoleWindow();
      ShowWindow( hWnd, SW_MINIMIZE );  //won't hide the window without SW_MINIMIZE
      ShowWindow( hWnd, SW_HIDE );
  }
  </code></pre>
  
  <p>This is what I tried but the compiler gives me </p>
  
  <blockquote>
    <p>initialization makes pointer from integer without a cast</p>
  </blockquote>
  
  <p>and the fatal one which actually stops the compiling:</p>
  
  <blockquote>
    <p>undefined reference to 'GetConsoleWindow'</p>
  </blockquote>
  
  <p>PS: I've checked <em>wincon.h</em> and the <code>GetConsoleWindow()</code> function is defined.</p>