SoulisProgrammer 2023-11-24 23:29 采纳率: 54.5%
浏览 62

esp32编译<BluetoothSerial.h>报错

遇到的问题

在开发esp32蓝牙功能的时候,每次编译带有<BluetoothSerial.h>这个库都会报错

错误信息
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\airm2m_core_esp32c3\firmware.elf] Error 1
====================================================================================== [FAILED] Took 9.54 seconds ======================================================================================

源代码
#include <Arduino.h>
#include <BluetoothSerial.h>

BluetoothSerial SerialBT;


void setup() {
    // put your setup code here, to run once;
    Serial.begin(115200);
    SerialBT.begin("ESP32");
    SerialBT.setPin("1234");
    Serial.printf("BT initial ok and ready to pair. \r\n");

}


void loop() {
    // put your main code here, to run repeatedly;
    if (Serial.available()) {
        SerialBT.write(Serial.read());
    }
    if (SerialBT.available()) {
        Serial.write(SerialBT.read());
    }
    delay(1);

}


详细报错内容
Processing airm2m_core_esp32c3 (platform: espressif32; board: airm2m_core_esp32c3; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/airm2m_core_esp32c3.html
PLATFORM: Espressif 32 (6.4.0) > AirM2M CORE ESP32C3
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- BluetoothSerial @ 2.0.0
Building in release mode
Linking .pio\build\airm2m_core_esp32c3\firmware.elf
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.L0 ':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:713: undefined reference to `esp_spp_disconnect'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `_stop_bt':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:714: undefined reference to `esp_spp_deinit'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.L0 ':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:189: undefined reference to `esp_spp_write'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:153: undefined reference to `esp_bt_gap_set_pin'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.LVL229':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:652: undefined reference to `esp_bt_gap_register_callback'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `_init_bt':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:665: undefined reference to `esp_spp_register_callback'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:669: undefined reference to `esp_spp_init'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:675: undefined reference to `esp_bt_gap_set_security_param'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:675: undefined reference to `esp_bt_gap_set_cod'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.LVL614':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:265: undefined reference to `esp_bt_gap_set_scan_mode'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `esp_spp_cb':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:271: undefined reference to `esp_spp_start_srv'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:283: undefined reference to `esp_spp_disconnect'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:364: undefined reference to `esp_spp_connect'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:385: undefined reference to `esp_spp_disconnect'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.L0 ':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:126: undefined reference to `esp_bt_gap_resolve_eir_data'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `get_name_from_eir':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:130: undefined reference to `esp_bt_gap_resolve_eir_data'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `.L0 ':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:456: undefined reference to `esp_bt_gap_cancel_discovery'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: .pio\build\airm2m_core_esp32c3\lib821\libBluetoothSerial.a(BluetoothSerial.cpp.o): in function `esp_bt_gap_cb':
C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:458: undefined reference to `esp_spp_start_discovery'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:528: undefined reference to `esp_bt_gap_pin_reply'
c:/users/26900/.platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: C:/Users/26900/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src/BluetoothSerial.cpp:528: undefined reference to `esp_bt_gap_ssp_confirm_reply'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\airm2m_core_esp32c3\firmware.elf] Error 1
====================================================================================== [FAILED] Took 9.54 seconds ======================================================================================


  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-11-25 08:37
    关注

    【相关推荐】




    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

问题事件

  • 创建了问题 11月24日

悬赏问题

  • ¥15 台达变频器MS300与伺服驱动器B3系列的抱闸与电路设计如何实现
  • ¥20 C++通过HICON获取argb像素数组
  • ¥15 如何利用支持向量机提高分类器正确率和筛选理想分类器
  • ¥15 Pygame坦克大战游戏开发实验报告
  • ¥15 用vmmare虚拟机用sentaurus仿真的时候,调用terminal程序,输入swb指令弹出这个,打不开workbench,桌面上面的sentaurus workbench也打不开
  • ¥75 使用winspool.drv的SetPrinter设置打印机失败
  • ¥15 simulink 硬件在环路仿真
  • ¥15 python动态规划:N根火柴摆出的最大数字
  • ¥20 (标签-excel)
  • ¥200 求idea10和MyEclipse7.1