c++ - 在 vs 2017 和 windows 10 中使用 BLuetoothAPIs.h 获取链接错误
问题描述
使用以下代码:
// Bluetooth_test.cpp : 定义控制台应用程序的入口点。//
#include "stdafx.h"
#include <windows.h>
#include "bthdef.h"
#include "BluetoothAPIs.h"
int main()
{
BLUETOOTH_DEVICE_SEARCH_PARAMS bptsp;
// set options for how we want to load our list of BT devices
bptsp.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS);
bptsp.fReturnAuthenticated = TRUE;
bptsp.fReturnRemembered = TRUE;
bptsp.fReturnUnknown = TRUE;
bptsp.fReturnConnected = TRUE;
bptsp.fIssueInquiry = TRUE;
bptsp.cTimeoutMultiplier = 4;
bptsp.hRadio = NULL;
BLUETOOTH_DEVICE_INFO bptdi;
bptdi.dwSize = sizeof(bptdi);
HBLUETOOTH_DEVICE_FIND hFind = BluetoothFindFirstDevice(&bptsp, &bptdi);
BluetoothFindDeviceClose(hFind);
return 0;
}
我收到以下错误:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _BluetoothFindFirstDevice@8 referenced in function _main Bluetooth_test D:\VS 2017\repos\Bluetooth_test\Bluetooth_test\Bluetooth_test.obj 1
Error LNK1120 2 unresolved externals Bluetooth_test D:\VS 2017\repos\Bluetooth_test\Debug\Bluetooth_test.exe 1
Error LNK2019 unresolved external symbol _BluetoothFindDeviceClose@4 referenced in function _main Bluetooth_test D:\VS 2017\repos\Bluetooth_test\Bluetooth_test\Bluetooth_test.obj 1
我对 C++ 很陌生,我不知道为什么它不能编译请帮助我
Windows API:
https://docs.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothfindfirstdevice https://docs.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf -bluetoothapis-bluetoothfinddeviceclose
==== 编辑 ==== 就像 Mike Petrichenko 在评论中所说的那样,当我#pragma comment(lib, "Bthprops.lib");
在包含下添加时,错误不会消失。
解决方案
推荐阅读
- postgresql - 多透视和多列上的 Postgresql 交叉表
- r - 带有因子的“点图”可视化
- listview - 如何在列表视图中获取文本字段的值?(扑)
- powershell - 如何使用powershell脚本连接到远程桌面并将文件从一个文件夹复制到另一个文件夹(以高架方式运行)
- java - 始终为 Null 时可调用
- c# - 在 C# 中多次询问用户同一个问题
- javascript - 为什么我不能以相同的方式将函数 () 绑定到 onload 事件和 resize 事件?
- graphviz - graphviz 在同一节点上多条边
- java - 更好的 Dagger 封装
- c# - 为什么导出的 ECDSA 密钥看起来很相似?