Vali_Ali

I have been trying to use the Vista¡¯s Native WiFi API ¨C however, without anything else, just including ¡°wlanapi.h¡± (and nothing else) starts giving me compile errors. I am wondering is there¡¯s a patch or some settings that I need to change since I cannot get the stuff to compile let alone use¡­ I am using Visual Studio 2005 and have the Service Pack 1 as well as the visual studio service pack 1 for vista installed as well¡­ What am I missing

I have noticed that there were other threads where people were having the same issue - while trying to use the API under XP SP2. I am trying thsi under Vista, using VS2005, with all of the service packs, etc. I even tried downloading one sample that someone wrote but had teh same issue that the program source wont compile due to teh same errors while compiling l2cmn.h, etc.

The errors start with l2cmn.h line 86 looks like this:

#ifdef __midl

[unique, size_is(dwDataSize)] PBYTE pData;

#else

__field_bcount(dwDataSize) PVOID pData;

#endif

The errors start when the system does not know how to resolve __field_bcount stuff¡­ That is justa start ¨C there are over 140 errors in l2cmn,h, wlantypes.h, windit11.h, etc¡­ L

Please help...




Re: Visual C++ General Error compiling wlanapi.h / l2cmn.h under Vista

Bite Qiu - MSFT

Can you paste out several error messages(like the first 5 messages) out of those 140 errors I suspect you are having LNK2019 and LNK2001 errors due to missing libraries or incorrectly installed WiFi API, if this is the case, check a) whether you have "Wlanapi.lib" in your additional dependencies list or not, b) whether you have "Wlanapi.lib" in your library path or not.




Re: Visual C++ General Error compiling wlanapi.h / l2cmn.h under Vista

Vali_Ali

Thx for looking into this...

The errors are indeed compile related. The CPP file simply has teh following line:

#include "stdafx.h"

#include "WLanAPI Test.h"

#include "WLanAPI TestDlg.h"

#include <wlanapi.h>

Trying to build the project, I get the following errors (I have attached only the initial few errors)...

1>WLanAPI TestDlg.cpp

1>c:\devtools\microsoft sdks\windows\v6.0\include\l2cmn.h(86) : error C2061: syntax error : identifier 'dwDataSize'

1>c:\devtools\microsoft sdks\windows\v6.0\include\l2cmn.h(86) : error C3646: 'PVOID' : unknown override specifier

1>c:\devtools\microsoft sdks\windows\v6.0\include\l2cmn.h(86) : error C3646: 'pData' : unknown override specifier

1>c:\devtools\microsoft sdks\windows\v6.0\include\l2cmn.h(86) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\devtools\microsoft sdks\windows\v6.0\include\l2cmn.h(86) : warning C4183: '__field_bcount': missing return type; assumed to be a member function returning 'int'

1>c:\devtools\microsoft sdks\windows\v6.0\include\wlantypes.h(27) : error C2059: syntax error : 'constant'

1>c:\devtools\microsoft sdks\windows\v6.0\include\wlantypes.h(29) : error C3646: 'ULONG' : unknown override specifier

1>c:\devtools\microsoft sdks\windows\v6.0\include\wlantypes.h(29) : error C3646: 'uSSIDLength' : unknown override specifier

1>c:\devtools\microsoft sdks\windows\v6.0\include\wlantypes.h(29) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\devtools\microsoft sdks\windows\v6.0\include\wlantypes.h(29) : warning C4183: '__range': missing return type; assumed to be a member function returning 'int'

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(39) : error C2146: syntax error : missing ';' before identifier 'Header'

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(70) : error C2059: syntax error : 'constant'

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(70) : error C3646: 'UCHAR' : unknown override specifier

1>c:\devtools\microsoft sdks\windows\v6.0\include\windot11.h(70) : error C3646: 'ucRateSet' : unknown override specifier

Thx.

Vali






Re: Visual C++ General Error compiling wlanapi.h / l2cmn.h under Vista

Bite Qiu - MSFT

Hi Vali,

I have been told that at least these files should been included:

Code Snippet
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <windows.h>
#include <winnt.h>
#include <wlanapi.h>

I haven't tried this because I don't have the environment, but I do hope this can fix your problem, looking forward to your feedback.

Also take this thread as a reference: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=577326&SiteID=1

thanks

rico






Re: Visual C++ General Error compiling wlanapi.h / l2cmn.h under Vista

somemsuser

Hi, I'm having the same problem, same error and everything. I am using VC++ 2005 Express on Windows XP Home SP2 with the Windows SDK and Wireless API installed. Simply including wlanapi.h causes the 140 errors. Any help would be greatly appreciated.

Thanks!