如何编译具有"wlanapi.h"和"windows.h"依赖项的C ++代码 [英] How To Compile C++ Code that has a 'wlanapi.h' and 'windows.h' dependency

查看:220
本文介绍了如何编译具有"wlanapi.h"和"windows.h"依赖项的C ++代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改一个开放源代码,用于扫描附近的无线信号.程序代码如下:

I am modifying an open source code that scans for Wireless signals in the vicinity. The program code goes like this:

#pragma comment(lib, "wlanapi.lib")

#include <stdio.h>
#include <windows.h>
#include <wlanapi.h>

VOID WlanNotification(WLAN_NOTIFICATION_DATA *wlanNotifData,VOID *p)
{
    if(wlanNotifData->NotificationCode == wlan_notification_acm_scan_complete)
    {
        bWait = false;
    }
    else if(wlanNotifData->NotificationCode == wlan_notification_acm_scan_fail)
    {
        printf("Scanning failed with error: %x\n", wlanNotifData->pData);
        bWait = false;

......

我想知道如何编译具有wlanapi.h和windows.h依赖项的源代码?

I wanted to know how I can compile the source code that has wlanapi.h and windows.h dependency?

请注意,我希望此代码在Windows(而非Linux)上运行.我正在为简单的Windows用户编写工具,该工具将为他们诊断Wifi安全.第一步是检测最近的WiFi AP及其各自的加密类型.我只想知道如何以最简单的方式为具有'windows.h'或'wlanapi.h'依赖关系的Windows平台编译此代码.

Please note that I want this code to run on Windows (Not Linux). I am coding a Tool for simple windows users that would diagnose their Wifi security for them. The first step is to sense the nearest WiFi APs and their respective Encryption Types. I just want to know how I can compile this code for windows platform that has a 'windows.h' or 'wlanapi.h' dependency, in the easiest possible way.

推荐答案

我找到了解决此问题的方法.

I have found a Solution to this problem.

在问题中,我询问了最简单的方法来编译具有"wlanapi"和"windows.h"等依赖项的代码.

In the Question I asked about the easiest possible way to compile a code with such dependencies as 'wlanapi' and 'windows.h'.

最简单的方法是在Windows框中安装"Microsoft Visual Studio",然后在相关的IDE中编译代码.

The easiest way is to install 'Microsoft Visual Studio' on Windows box and then compile the code in the relevant IDE.

例如,问题中的代码是C ++代码,因此我将在Visual C ++中对其进行编译(生成")

For Example the code in the question is a C++ code, so I would compile it ('Build') in Visual C++

对于那些研究此问题并试图在Linux机器上编译使用深层Windows API的代码的人,请知道这是一个坏主意.在Windows框的"Windows SDK"或Visual Studio下对其进行编译.

For anyone who looks at this and is trying to compile a code that uses deep windows APIs, on a linux box, please know that it is a bad bad idea. Compile it under 'Windows SDK' or Visual Studio on a Windows box.

这篇关于如何编译具有"wlanapi.h"和"windows.h"依赖项的C ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆