title: error: 'WlanScan' was not declared in this scope
body: <p>I have been playing around with wlanapi in windows. I did not have any problem compiling or running until I tried using the function <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms706783(v=vs.85).aspx" rel="nofollow">WlanScan</a>. Then I was unable to compile due to "WlanScan" not being declared in the scope. I wrote a really short program illustrating this using two functions: <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms706759(v=vs.85).aspx" rel="nofollow">WlanOpenHandle</a> that works and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms706783(v=vs.85).aspx" rel="nofollow">WlanScan</a> which doesn't.</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;wlanapi.h&gt;
  
  int main()
  {
      HANDLE hClient;
      WlanOpenHandle(2, 0, 0, &amp;hClient);
  
      WlanScan(hClient, 0, 0, 0, 0);
  }
  </code></pre>
  
  <p>Compiling that single file like this:</p>
  
  <pre><code>g++ main.cpp -lwlanapi
  </code></pre>
  
  <p>Results in this error:</p>
  
  <pre><code>main.cpp: In function 'int main()':
  main.cpp:9:30: error: 'WlanScan' was not declared in this scope
    WlanScan(hClient, 0, 0, 0, 0);
                                ^
  </code></pre>
  
  <p>What could be the cause of this? I've been able to use a handful of functions from the wlanapi. I am on Windows 7 compiling with minGW.</p>
  
  <p><strong>EDIT:</strong>
  In accordance to what u/ IInspectable said, I changed the command used to compile to:</p>
  
  <pre><code>g++ -D_WIN32_WINNT=_WIN32_WINNT_WIN7 main.cpp -lwlanapi
  </code></pre>
  
  <p>And it worked!</p>