Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

undefined reference to `BLESecurity::m_authReq' #11671

Closed
Assignees
Labels
Area: BLEIssues related to BLE
@jol888

Description

Board

AirM2M_CORE_ESP32C3

Device Description

nothing

Hardware Configuration

nothing

Version

v3.3.0

Type

Bug

IDE Name

Arduino-cli

Operating System

Archlinux

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

115200

Description

I called setAuthenticationMode(1,0,0) in my program and a linking error occured.

I guess it's a static variable but only defined in the headers but not in .cpp files. Adding uint8_t BLESecurity::m_authReq; to BLEScurity.cpp:39 fix the link error, but i don't know if it runs well.

Sketch

#include "BLEHIDDevice.h"
#include "BLECharacteristic.h"
void setup() {
 BLESecurity* pSecurity = new BLESecurity();
 pSecurity->setAuthenticationMode(true);
}
void loop(){}

Debug Message

/home/xhze/.arduino15/packages/esp32/tools/esp-rv32/2411-cn/bin/../lib/gcc/riscv32-esp-elf/14.2.0/../../../../riscv32-esp-elf/bin/ld: /home/xhze/test/build/libraries/BLE/BLESecurity.cpp.o: in function `BLESecurity::setAuthenticationMode(bool, bool, bool)':
/home/xhze/.arduino15/packages/esp32/hardware/esp32/3.3.0-cn/libraries/BLE/src/BLESecurity.cpp:141:(.text._ZN11BLESecurity21setAuthenticationModeEbbb+0xc): undefined reference to `BLESecurity::m_authReq'
/home/xhze/.arduino15/packages/esp32/tools/esp-rv32/2411-cn/bin/../lib/gcc/riscv32-esp-elf/14.2.0/../../../../riscv32-esp-elf/bin/ld: /home/xhze/.arduino15/packages/esp32/hardware/esp32/3.3.0-cn/libraries/BLE/src/BLESecurity.cpp:141:(.text._ZN11BLESecurity21setAuthenticationModeEbbb+0x10): undefined reference to `BLESecurity::m_authReq'
/home/xhze/.arduino15/packages/esp32/tools/esp-rv32/2411-cn/bin/../lib/gcc/riscv32-esp-elf/14.2.0/../../../../riscv32-esp-elf/bin/ld: /home/xhze/test/build/libraries/BLE/BLESecurity.cpp.o: in function `BLESecurity::setAuthenticationMode(unsigned char)':
/home/xhze/.arduino15/packages/esp32/hardware/esp32/3.3.0-cn/libraries/BLE/src/BLESecurity.cpp:50:(.text._ZN11BLESecurity21setAuthenticationModeEh+0x8): undefined reference to `BLESecurity::m_authReq'
/home/xhze/.arduino15/packages/esp32/tools/esp-rv32/2411-cn/bin/../lib/gcc/riscv32-esp-elf/14.2.0/../../../../riscv32-esp-elf/bin/ld: /home/xhze/.arduino15/packages/esp32/hardware/esp32/3.3.0-cn/libraries/BLE/src/BLESecurity.cpp:50:(.text._ZN11BLESecurity21setAuthenticationModeEh+0xc): undefined reference to `BLESecurity::m_authReq'
collect2: error: ld returned 1 exit status
Using library BLE at version 3.3.0 in folder: /home/xhze/.arduino15/packages/esp32/hardware/esp32/3.3.0-cn/libraries/BLE

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Labels

Area: BLEIssues related to BLE

Type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /