乐鑫技术交流
直播中

李艺银

7年用户 1052经验值
私信 关注
[问答]

Eclipse IDE+IDF- 蓝牙例程“A2DP_Source\"编译错误:undefined reference to...\"怎么解决?

大家好,最近因为需要选择蓝牙音频例程a2dp_source作为基本模板做开发,但是第一步就卡住了。
在eclipse IDE中导入例程,编译的时候出错,很多undefined reference to 错误
我想说的是我编译很多其他例程都没问题,比如hello world,所以编译环境应该是没问题的。
然后例程的文件都是通过cmake进行整合的,cmake我不太懂,而且牵连很广,大致看了下也看不出问题。
我换了vscode,结果是一样的,也是这种错误。(之前是64个错误,但我idf+ide装卸很多遍+python独立安装,现在的错误是44个),
快崩溃了,大佬救命!编译结果如下:谢谢!

构建位置: D:workaudioESPmicbt8build
cmake --build . -- -v
[1/6] cmd.exe /C "cd /D D:workaudioESPmicbt8buildbootloader && D:Espressiftoolscmake3.24.0bincmake.exe --build ."
[1/1] cmd.exe /C "cd /D D:workaudioESPmicbt8buildbootloaderesp-idfesptool_py && python D:/Espressif/frameworks/esp-idf-v5.0.2/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 D:/work/audio/ESP/micbt8/build/bootloader/bootloader.bin"
Bootloader binary size 0x4ee0 bytes. 0x3120 bytes (38%) free.
[2/4] cmd.exe /C "cd . && D:Espressiftoolsriscv32-esp-elfesp-2022r1-11.2.0riscv32-esp-elfbinriscv32-esp-elf-g++.exe -march=rv32imc -nostartfiles -march=rv32imc --specs=nosys.specs @CMakeFilesa2dp_source.elf.rsp -o a2dp_source.elf  && cd ."
FAILED: a2dp_source.elf
cmd.exe /C "cd . && D:Espressiftoolsriscv32-esp-elfesp-2022r1-11.2.0riscv32-esp-elfbinriscv32-esp-elf-g++.exe -march=rv32imc -nostartfiles -march=rv32imc --specs=nosys.specs @CMakeFilesa2dp_source.elf.rsp -o a2dp_source.elf  && cd ."
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_av_volume_changed':
D:/work/audio/ESP/micbt8/main/main.c:638: undefined reference to `esp_avrc_rn_evt_bit_mask_operation'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:640: undefined reference to `esp_avrc_ct_send_register_notification_cmd'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_av_state_connecting_hdlr':
D:/work/audio/ESP/micbt8/main/main.c:440: undefined reference to `esp_bt_gap_set_scan_mode'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_av_state_disconnecting_hdlr':
D:/work/audio/ESP/micbt8/main/main.c:594: undefined reference to `esp_bt_gap_set_scan_mode'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_av_hdl_stack_evt':
D:/work/audio/ESP/micbt8/main/main.c:309: undefined reference to `esp_bt_gap_register_callback'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:309: undefined reference to `esp_avrc_ct_init'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:312: undefined reference to `esp_avrc_ct_register_callback'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:315: undefined reference to `esp_avrc_rn_evt_bit_mask_operation'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:315: undefined reference to `esp_avrc_tg_set_rn_evt_cap'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:316: undefined reference to `esp_a2d_source_init'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:319: undefined reference to `esp_a2d_register_callback'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:320: undefined reference to `esp_a2d_source_register_data_callback'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:322: undefined reference to `esp_bt_gap_set_scan_mode'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:326: undefined reference to `esp_bt_gap_start_discovery'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_av_state_unconnected_hdlr':
D:/work/audio/ESP/micbt8/main/main.c:411: undefined reference to `esp_a2d_source_connect'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_av_media_proc':
D:/work/audio/ESP/micbt8/main/main.c:530: undefined reference to `esp_a2d_media_ctrl'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:485: undefined reference to `esp_a2d_media_ctrl'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:479: undefined reference to `esp_a2d_media_ctrl'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:512: undefined reference to `esp_a2d_media_ctrl'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:526: undefined reference to `esp_a2d_source_disconnect'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_av_state_connected_hdlr':
D:/work/audio/ESP/micbt8/main/main.c:552: undefined reference to `esp_bt_gap_set_scan_mode'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `get_name_from_eir':
D:/work/audio/ESP/micbt8/main/main.c:140: undefined reference to `esp_bt_gap_resolve_eir_data'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:142: undefined reference to `esp_bt_gap_resolve_eir_data'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `filter_inquiry_scan_result':
D:/work/audio/ESP/micbt8/main/main.c:206: undefined reference to `esp_bt_gap_cancel_discovery'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_app_gap_cb':
D:/work/audio/ESP/micbt8/main/main.c:234: undefined reference to `esp_bt_gap_start_discovery'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:230: undefined reference to `esp_a2d_source_connect'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:257: undefined reference to `esp_bt_gap_pin_reply'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: D:/work/audio/ESP/micbt8/main/main.c:265: undefined reference to `esp_bt_gap_pin_reply'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_av_notify_evt_handler':
D:/work/audio/ESP/micbt8/main/main.c:651: undefined reference to `esp_avrc_ct_send_set_absolute_volume_cmd'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `bt_av_hdl_avrc_ct_evt':
D:/work/audio/ESP/micbt8/main/main.c:675: undefined reference to `esp_avrc_ct_send_get_rn_capabilities_cmd'
d:/espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/11.2.0/../../../../riscv32-esp-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `app_main':
D:/work/audio/ESP/micbt8/main/main.c:755: undefined reference to `esp_bt_gap_set_pin'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
构建完成(44 个错误,0 个警告): D:workaudioESPmicbt8build
d:Espressifpython_envidf5.0_py3.11_envScriptspython.exe d:Espressifframeworksesp-idf-v5.0.2toolsidf_size.py D:/work/audio/ESP/micbt8/build/a2dp_source.map
Total sizes:

Used stat D/IRAM:   93390 bytes ( 227906 remain, 29.1% used)

回帖(2)

王丽华

2024-6-11 10:55:57
编译之前可以检查下A2DP的配置项是否打开:
1) 在例程目录下终端输入: idf.py menuconfig
2) 路径: Component config->Bluetooth->Bluedroid Options->Calssic Bluetooth->A2DP
3) 将A2DP选上.
举报

张娟

2024-6-11 16:57:19
您好!看起来您在使用Eclipse IDE和ESP-IDF时遇到了一些编译问题。根据您提供的错误信息,这些错误可能是由于链接问题导致的。以下是一些建议来解决这些问题:

1. 确保您的ESP-IDF版本与Eclipse IDE兼容。您可以访问ESP-IDF的GitHub页面(https://github.com/espressif/esp-idf)查看最新版本,并根据您的需求选择合适的版本。

2. 检查您的CMakeLists.txt文件。确保所有需要的库和组件都已正确添加。例如,对于A2DP源例程,您可能需要添加以下内容:

```
set(COMPONENT_REQUIRES esp-adf-libs)
set(COMPONENT_PRIV_REQUIRES esp_wifi esp_adc_cal audio_sal audio_pipeline audio_board esp_spp)
```

3. 确保您的环境变量设置正确。检查ESP-IDF的路径是否已添加到环境变量中,以便Eclipse IDE可以找到所需的库和工具。

4. 清理并重新编译项目。在Eclipse IDE中,您可以通过以下步骤进行操作:
   a. 右键点击项目,选择"Clean Project"。
   b. 等待清理过程完成。
   c. 再次右键点击项目,选择"Build Project"。

5. 如果问题仍然存在,您可以尝试在命令行中使用`idf.py`工具手动编译项目。这可以帮助您更清楚地了解编译过程中出现的问题。您可以按照以下步骤操作:
   a. 打开命令行工具。
   b. 导航到您的项目目录。
   c. 运行`idf.py build`命令。


举报

更多回帖

发帖
×
20
完善资料,
赚取积分