Using the following code:
// Bluetooth_test.cpp : Defines the entry point for the console application. //
#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;
}
I get the following errors:
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
I am pretty new to C++ and I have no clue why it won't compile please help me
Windows API's:
https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothfindfirstdevice https://learn.microsoft.com/en-us/windows/win32/api/bluetoothapis/nf-bluetoothapis-bluetoothfinddeviceclose
==== EDIT ====
Like Mike Petrichenko said in the comments, the errors won't acure when I add #pragma comment(lib, "Bthprops.lib");
underneath the includes.