This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error with pc-ble-driver in Visual Studio

I am trying to build a project using the includes/libraries in pc-ble-driver in Visual Studio 19. I have been having linker problems, and I found a support ticket with a similar issue. I followed the instructions in the answer exactly:

  1. New project -> Visual C++ -> Windows Console Application -> OK
  2. In ConesoleApplication.cpp, I replaced the content with this one -> https://github.com/NordicSemiconductor/pc-ble-driver/blob/master/examples/heart_rate_collector/main.c
  3. In the Solution Explorer, right click on ConsoleApplication -> Properties -> VC++ Directories -> “Include Directories” -> Edit ->  New line, find the pc-ble-driver include folder , (e.g. C:\Nordic\nrf-ble-driver-4.1.1-win_x86_32 \include\sd_api_v6) -> OK.
  4. In the Solution Explorer, right click on ConsoleApplication -> Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions -> Edit-> By default there are “WIN32, _DEBUG and _CONSOLE. Add:

    PC_BLE_DRIVER_STATIC

     _CRT_SECURE_NO_WARNINGS

    NRF_SD_BLE_API=6  
  5. In the Solution Explorer, right click on ConsoleApplication -> Properties -> C/C++ -> Precompiled Headers -> Precompiled Header -> Set to “Not using precompiled Headers”.
  6. In the Solution Explorer, right click on Header Files -> Add -> Existing Item.. -> Mark all the .h files in folder “nrf-ble-driver-4.1.1-win_x86_32\include\sd_api_v6”, there should be 18 files -> OK.
  7. In the Solution Explorer, right click on “Source Files”, Add -> Existing Item.. -> Find the lib folder, and add nrf-ble-driver-sd_api_v6-mt-static-4_1_1.lib -> OK
  8. Build -> Build Solution

However, I am still getting errors. The errors are as follows:

Error    LNK1120    17 unresolved externals
Warning    LNK4272    library machine type 'x64' conflicts with target machine type 'x86'
Error    LNK2019    unresolved external symbol _sd_ble_cfg_set referenced in function _ble_cfg_set
Error    LNK2019    unresolved external symbol _sd_ble_enable referenced in function _ble_stack_init
Error    LNK2019    unresolved external symbol _sd_ble_gap_connect referenced in function _on_adv_report
Error    LNK2019    unresolved external symbol _sd_ble_gap_conn_param_update referenced in function _on_conn_params_update_request
Error    LNK2019    unresolved external symbol _sd_ble_gap_scan_start referenced in function _on_adv_report
Error    LNK2019    unresolved external symbol _sd_ble_gattc_characteristics_discover referenced in function _char_discovery_start
Error    LNK2019    unresolved external symbol _sd_ble_gattc_descriptors_discover referenced in function _descr_discovery_start
Error    LNK2019    unresolved external symbol _sd_ble_gattc_primary_services_discover referenced in function _service_discovery_start
Error    LNK2019    unresolved external symbol _sd_ble_gattc_write referenced in function _hrm_cccd_set
Error    LNK2019    unresolved external symbol _sd_ble_gatts_exchange_mtu_reply referenced in function _on_exchange_mtu_request
Error    LNK2019    unresolved external symbol _sd_rpc_adapter_create referenced in function _adapter_init
Error    LNK2019    unresolved external symbol _sd_rpc_close referenced in function _main
Error    LNK2019    unresolved external symbol _sd_rpc_data_link_layer_create_bt_three_wire referenced in function _adapter_init
Error    LNK2019    unresolved external symbol _sd_rpc_log_handler_severity_filter_set referenced in function _main
Error    LNK2019    unresolved external symbol _sd_rpc_open referenced in function _main
Error    LNK2019    unresolved external symbol _sd_rpc_physical_layer_create_uart referenced in function _adapter_init
Error    LNK2019    unresolved external symbol _sd_rpc_transport_layer_create referenced in function _adapter_init

It seems that the functions aren't being seen by the project, despite adding the .lib to the solution as described in the above answer.

Parents Reply Children
No Data
Related