undefined reference to,链接时总是报这个错误

greenstone
Posts: 20
Joined: Mon Jul 10, 2023 9:14 am

undefined reference to,链接时总是报这个错误

Postby greenstone » Mon Sep 02, 2024 1:43 am

各位群友大家好:
我精简了一个小工程,自己写了六个自定义组件,最后一个一个自定义组件加入工程中进行编译时,附件图片中的六个组件依次加入工程编译没有问题,能够正确得到.bin文件,但最后一个简单组件wifi_app加入工程后,总是出现undefined reference to错误(这个组件调用了另一个自定义组件port_event中的置事件组位port_set_status(EVENT_GROUP_SELECT_T, unsigned long),清事件组位`port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)自定义函数),就是链接这两个函数时总是出现未定义问题,请各位大神帮我看看,是否有什么问题?卡在这里好久了,百度,中文论坛,还有乐鑫官网都上去看了,没有发现有价值的线索。
附上自己打包的小工程,里面含有skdconfig,以及我自己写的CMakeLists。我采用的是WINDOS下编译,在VSCODE中编辑,安装了ESP-IDF扩展,版本是V5.3.0。

构建时提示的信息如下:
-- Found Git: D:/Espressif/TOOL/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- git describe returned 'fatal: bad revision 'HEAD''
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file D:/example-sms/new1/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- Found Python3: d:/Espressif/TOOL/python_env/idf5.3_py3.11_env/Scripts/python.exe (found version "3.11.2") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "ADI-SMS" version: 1
-- Adding linker script D:/example-sms/new1/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script D:/example-sms/new1/build/esp-idf/esp_system/ld/sections.ld.in
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_bootloader_format esp_coex esp_common esp_driver_ana_cmpr esp_driver_cam esp_driver_dac esp_driver_gpio esp_driver_gptimer esp_driver_i2c esp_driver_i2s esp_driver_isp esp_driver_jpeg esp_driver_ledc esp_driver_mcpwm esp_driver_parlio esp_driver_pcnt esp_driver_ppa esp_driver_rmt esp_driver_sdio esp_driver_sdm esp_driver_sdmmc esp_driver_sdspi esp_driver_spi esp_driver_tsens esp_driver_uart esp_driver_usb_serial_jtag esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_vfs_console esp_wifi espcoredump esptool_py fatfs freertos hal
hal_param_manage heap http_parser idf_test ieee802154 json linux_list log lwip main main_config mbedtls mqtt newlib nvs_flash nvs_sec_provider openthread partition_table perfmon port_debug port_event port_timer protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_app wifi_provisioning wpa_supplicant xtensa
-- Component paths: D:/Espressif/v5.3/esp-idf/components/app_trace D:/Espressif/v5.3/esp-idf/components/app_update D:/Espressif/v5.3/esp-idf/components/bootloader D:/Espressif/v5.3/esp-idf/components/bootloader_support D:/Espressif/v5.3/esp-idf/components/bt D:/Espressif/v5.3/esp-idf/components/cmock D:/Espressif/v5.3/esp-idf/components/console D:/Espressif/v5.3/esp-idf/components/cxx D:/Espressif/v5.3/esp-idf/components/driver D:/Espressif/v5.3/esp-idf/components/efuse D:/Espressif/v5.3/esp-idf/components/esp-tls D:/Espressif/v5.3/esp-idf/components/esp_adc D:/Espressif/v5.3/esp-idf/components/esp_app_format D:/Espressif/v5.3/esp-idf/components/esp_bootloader_format D:/Espressif/v5.3/esp-idf/components/esp_coex D:/Espressif/v5.3/esp-idf/components/esp_common D:/Espressif/v5.3/esp-idf/components/esp_driver_ana_cmpr D:/Espressif/v5.3/esp-idf/components/esp_driver_cam D:/Espressif/v5.3/esp-idf/components/esp_driver_dac D:/Espressif/v5.3/esp-idf/components/esp_driver_gpio D:/Espressif/v5.3/esp-idf/components/esp_driver_gptimer D:/Espressif/v5.3/esp-idf/components/esp_driver_i2c D:/Espressif/v5.3/esp-idf/components/esp_driver_i2s D:/Espressif/v5.3/esp-idf/components/esp_driver_isp D:/Espressif/v5.3/esp-idf/components/esp_driver_jpeg D:/Espressif/v5.3/esp-idf/components/esp_driver_ledc D:/Espressif/v5.3/esp-idf/components/esp_driver_mcpwm D:/Espressif/v5.3/esp-idf/components/esp_driver_parlio D:/Espressif/v5.3/esp-idf/components/esp_driver_pcnt D:/Espressif/v5.3/esp-idf/components/esp_driver_ppa D:/Espressif/v5.3/esp-idf/components/esp_driver_rmt D:/Espressif/v5.3/esp-idf/components/esp_driver_sdio D:/Espressif/v5.3/esp-idf/components/esp_driver_sdm D:/Espressif/v5.3/esp-idf/components/esp_driver_sdmmc D:/Espressif/v5.3/esp-idf/components/esp_driver_sdspi D:/Espressif/v5.3/esp-idf/components/esp_driver_spi D:/Espressif/v5.3/esp-idf/components/esp_driver_tsens D:/Espressif/v5.3/esp-idf/components/esp_driver_uart D:/Espressif/v5.3/esp-idf/components/esp_driver_usb_serial_jtag D:/Espressif/v5.3/esp-idf/components/esp_eth D:/Espressif/v5.3/esp-idf/components/esp_event D:/Espressif/v5.3/esp-idf/components/esp_gdbstub D:/Espressif/v5.3/esp-idf/components/esp_hid D:/Espressif/v5.3/esp-idf/components/esp_http_client D:/Espressif/v5.3/esp-idf/components/esp_http_server D:/Espressif/v5.3/esp-idf/components/esp_https_ota D:/Espressif/v5.3/esp-idf/components/esp_https_server D:/Espressif/v5.3/esp-idf/components/esp_hw_support D:/Espressif/v5.3/esp-idf/components/esp_lcd D:/Espressif/v5.3/esp-idf/components/esp_local_ctrl D:/Espressif/v5.3/esp-idf/components/esp_mm D:/Espressif/v5.3/esp-idf/components/esp_netif D:/Espressif/v5.3/esp-idf/components/esp_netif_stack D:/Espressif/v5.3/esp-idf/components/esp_partition D:/Espressif/v5.3/esp-idf/components/esp_phy D:/Espressif/v5.3/esp-idf/components/esp_pm D:/Espressif/v5.3/esp-idf/components/esp_psram D:/Espressif/v5.3/esp-idf/components/esp_ringbuf D:/Espressif/v5.3/esp-idf/components/esp_rom
D:/Espressif/v5.3/esp-idf/components/esp_system D:/Espressif/v5.3/esp-idf/components/esp_timer D:/Espressif/v5.3/esp-idf/components/esp_vfs_console D:/Espressif/v5.3/esp-idf/components/esp_wifi D:/Espressif/v5.3/esp-idf/components/espcoredump D:/Espressif/v5.3/esp-idf/components/esptool_py D:/Espressif/v5.3/esp-idf/components/fatfs D:/Espressif/v5.3/esp-idf/components/freertos D:/Espressif/v5.3/esp-idf/components/hal D:/example-sms/new1/components/hal_param_manage D:/Espressif/v5.3/esp-idf/components/heap D:/Espressif/v5.3/esp-idf/components/http_parser D:/Espressif/v5.3/esp-idf/components/idf_test D:/Espressif/v5.3/esp-idf/components/ieee802154 D:/Espressif/v5.3/esp-idf/components/json D:/example-sms/new1/components/linux_list D:/Espressif/v5.3/esp-idf/components/log D:/Espressif/v5.3/esp-idf/components/lwip D:/example-sms/new1/main D:/example-sms/new1/components/main_config D:/Espressif/v5.3/esp-idf/components/mbedtls D:/Espressif/v5.3/esp-idf/components/mqtt D:/Espressif/v5.3/esp-idf/components/newlib D:/Espressif/v5.3/esp-idf/components/nvs_flash D:/Espressif/v5.3/esp-idf/components/nvs_sec_provider D:/Espressif/v5.3/esp-idf/components/openthread D:/Espressif/v5.3/esp-idf/components/partition_table D:/Espressif/v5.3/esp-idf/components/perfmon D:/example-sms/new1/components/port_debug D:/example-sms/new1/components/port_event D:/example-sms/new1/components/port_timer D:/Espressif/v5.3/esp-idf/components/protobuf-c D:/Espressif/v5.3/esp-idf/components/protocomm D:/Espressif/v5.3/esp-idf/components/pthread D:/Espressif/v5.3/esp-idf/components/sdmmc D:/Espressif/v5.3/esp-idf/components/soc D:/Espressif/v5.3/esp-idf/components/spi_flash D:/Espressif/v5.3/esp-idf/components/spiffs D:/Espressif/v5.3/esp-idf/components/tcp_transport D:/Espressif/v5.3/esp-idf/components/ulp D:/Espressif/v5.3/esp-idf/components/unity D:/Espressif/v5.3/esp-idf/components/usb D:/Espressif/v5.3/esp-idf/components/vfs
D:/Espressif/v5.3/esp-idf/components/wear_levelling D:/example-sms/new1/components/wifi_app D:/Espressif/v5.3/esp-idf/components/wifi_provisioning D:/Espressif/v5.3/esp-idf/components/wpa_supplicant D:/Espressif/v5.3/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: D:/example-sms/new1/build

* 正在执行任务: d:\Espressif\TOOL\tools\ninja\1.11.1\ninja.exe

[5/979] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
ota_0,app,ota_0,0x10000,1600K,
ota_1,app,ota_1,0x1a0000,1600K,
storage_c,data,spiffs,0x330000,832K,
*******************************************************************************
[400/979] Performing configure step for 'bootloader'
-- Found Git: D:/Espressif/TOOL/tools/idf-git/2.39.2/cmd/git.exe (found version "2.39.2.windows.1")
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file D:/example-sms/new1/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Bootloader project name: "bootloader" version: 1
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script D:/Espressif/v5.3/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_bootloader_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: D:/Espressif/v5.3/esp-idf/components/bootloader D:/Espressif/v5.3/esp-idf/components/bootloader_support D:/Espressif/v5.3/esp-idf/components/efuse D:/Espressif/v5.3/esp-idf/components/esp_app_format D:/Espressif/v5.3/esp-idf/components/esp_bootloader_format D:/Espressif/v5.3/esp-idf/components/esp_common D:/Espressif/v5.3/esp-idf/components/esp_hw_support D:/Espressif/v5.3/esp-idf/components/esp_rom D:/Espressif/v5.3/esp-idf/components/esp_system D:/Espressif/v5.3/esp-idf/components/esptool_py D:/Espressif/v5.3/esp-idf/components/freertos D:/Espressif/v5.3/esp-idf/components/hal D:/Espressif/v5.3/esp-idf/components/log D:/Espressif/v5.3/esp-idf/components/bootloader/subproject/main D:/Espressif/v5.3/esp-idf/components/bootloader/subproject/components/micro-ecc D:/Espressif/v5.3/esp-idf/components/newlib D:/Espressif/v5.3/esp-idf/components/partition_table D:/Espressif/v5.3/esp-idf/components/soc D:/Espressif/v5.3/esp-idf/components/spi_flash D:/Espressif/v5.3/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: D:/example-sms/new1/build/bootloader
[522/979] Performing build step for 'bootloader'
[1/108] Generating project_elf_src_esp32.c
[2/108] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj
[3/108] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xt_trax.c.obj
[4/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[5/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[6/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/dport_access_common.c.obj
[7/108] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[8/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[9/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[10/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dport_access.c.obj
[11/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[12/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/emac_periph.c.obj
[13/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[14/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[15/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[16/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[17/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdm_periph.c.obj
[18/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[19/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[20/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[21/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/lcd_periph.c.obj
[22/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/mcpwm_periph.c.obj
[23/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/mpi_periph.c.obj
[24/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[25/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[26/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[27/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/twai_periph.c.obj
[28/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[29/108] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[30/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj
[31/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/hal_utils.c.obj
[32/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[33/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/efuse_hal.c.obj
[34/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mmu_hal.c.obj
[35/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[36/108] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_wrap.c.obj
[37/108] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/cache_hal_esp32.c.obj
[38/108] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[39/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[40/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[41/108] Building C object esp-idf/esp_bootloader_format/CMakeFiles/__idf_esp_bootloader_format.dir/esp_bootloader_desc.c.obj
[42/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[43/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[44/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[45/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse.c.obj
[46/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[47/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[48/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[49/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/flash_qio_mode.c.obj
[50/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj
[51/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash_config_esp32.c.obj
[52/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[53/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[54/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[55/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[56/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[57/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_soc.c.obj
[58/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[59/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[60/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[61/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[62/108] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[63/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[64/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_fields.c.obj
[65/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_utility.c.obj
[66/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[67/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[68/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[69/108] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c.obj
[70/108] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[71/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj
[72/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/esp_cpu_intr.c.obj
[73/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj
[74/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/cpu_region_protect.c.obj
[75/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[76/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[77/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[78/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[79/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[80/108] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/chip_info.c.obj
[81/108] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[82/108] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[83/108] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[84/108] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[85/108] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_efuse.c.obj
[86/108] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[87/108] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[88/108] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_spiflash.c.obj
[89/108] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[90/108] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[91/108] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[92/108] Linking C static library esp-idf\log\liblog.a
[93/108] Linking C static library esp-idf\esp_rom\libesp_rom.a
[94/108] Linking C static library esp-idf\esp_common\libesp_common.a
[95/108] Linking C static library esp-idf\esp_hw_support\libesp_hw_support.a
[96/108] Linking C static library esp-idf\esp_system\libesp_system.a
[97/108] Linking C static library esp-idf\efuse\libefuse.a
[98/108] Linking C static library esp-idf\bootloader_support\libbootloader_support.a
[99/108] Linking C static library esp-idf\esp_bootloader_format\libesp_bootloader_format.a
[100/108] Linking C static library esp-idf\spi_flash\libspi_flash.a
[101/108] Linking C static library esp-idf\hal\libhal.a
[102/108] Linking C static library esp-idf\micro-ecc\libmicro-ecc.a
[103/108] Linking C static library esp-idf\soc\libsoc.a
[104/108] Linking C static library esp-idf\xtensa\libxtensa.a
[105/108] Linking C static library esp-idf\main\libmain.a
[106/108] Linking C executable bootloader.elf
[107/108] Generating binary image from built executable
esptool.py v4.8.dev4
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Generated D:/example-sms/new1/build/bootloader/bootloader.bin
[108/108] cmd.exe /C "cd /D D:\example-sms\new1\build\bootloader\esp-idf\esptool_py && d:\Espressif\TOOL\python_env\idf5.3_py3.11_env\Scripts\python.exe D:/Espressif/v5.3/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 D:/example-sms/new1/build/bootloader/bootloader.bin"
Bootloader binary size 0x6880 bytes. 0x780 bytes (7%) free.
[970/979] Building C object esp-idf/port_timer/CMakeFiles/__idf_port_timer.dir/port_timer.c.obj
In file included from D:/example-sms/new1/components/port_timer/port_timer.c:6:
D:/Espressif/v5.3/esp-idf/components/driver/deprecated/driver/timer.h:16:2: warning: #warning "legacy timer group driver is deprecated, please migrate to driver/gptimer.h" [-Wcpp]
16 | #warning "legacy timer group driver is deprecated, please migrate to driver/gptimer.h"
| ^~~~~~~
[977/979] Linking CXX executable ADI-SMS.elf
FAILED: ADI-SMS.elf
cmd.exe /C "cd . && D:\Espressif\TOOL\tools\xtensa-esp-elf\esp-13.2.0_20240530\xtensa-esp-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address -fno-builtin-memcpy
-fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32=0 -Wl,--Map=D:/example-sms/new1/build/ADI-SMS.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T esp32.peripherals.ld -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld -T memory.ld -T sections.ld @CMakeFiles\ADI-SMS.elf.rsp -o ADI-SMS.elf && cd ."
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/wifi_app/libwifi_app.a(wifi_device.cpp.obj):(.literal._ZL13event_handlerPvPKclS_+0x30): undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/wifi_app/libwifi_app.a(wifi_device.cpp.obj):(.literal._ZL13event_handlerPvPKclS_+0x34): undefined reference to `port_get_status(EVENT_GROUP_SELECT_T, unsigned long, int, int, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/wifi_app/libwifi_app.a(wifi_device.cpp.obj):(.literal._ZL13event_handlerPvPKclS_+0x38): undefined reference to `port_set_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: esp-idf/wifi_app/libwifi_app.a(wifi_device.cpp.obj): in function `event_handler(void*, char const*, long, void*)':
D:/example-sms/new1/components/wifi_app/wifi_device.cpp:34:(.text._ZL13event_handlerPvPKclS_+0x3c): undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:37:(.text._ZL13event_handlerPvPKclS_+0x69): undefined reference to `port_get_status(EVENT_GROUP_SELECT_T, unsigned long, int, int, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:41:(.text._ZL13event_handlerPvPKclS_+0x92): undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:46:(.text._ZL13event_handlerPvPKclS_+0xb0): undefined reference to `port_set_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:47:(.text._ZL13event_handlerPvPKclS_+0xba): undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:55:(.text._ZL13event_handlerPvPKclS_+0x13a): undefined reference to `port_set_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:60:(.text._ZL13event_handlerPvPKclS_+0x18a): undefined reference to `port_clear_status(EVENT_GROUP_SELECT_T, unsigned long)'
D:/Espressif/TOOL/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: D:/example-sms/new1/components/wifi_app/wifi_device.cpp:61:(.text._ZL13event_handlerPvPKclS_+0x19d): undefined reference to `port_set_status(EVENT_GROUP_SELECT_T, unsigned long)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

* 终端进程“d:\Espressif\TOOL\tools\ninja\1.11.1\ninja.exe”已终止,退出代码: 1。
Attachments
绿色圆圈组件加入工程没有问题-红色组件加入工程链接时候undefined reference to.png
其它组件编译可以正确得到.bin,但是加入这个组件并调用其中的函数出现undefined reference to错误
绿色圆圈组件加入工程没有问题-红色组件加入工程链接时候undefined reference to.png (168.57 KiB) Viewed 1851 times
加入这个组件并调用其中的函数出错.png
加入这个wifi_app组件并调用了其中的一个函数出错
加入这个组件并调用其中的函数出错.png (189.13 KiB) Viewed 1851 times
new1.rar
VSCODE下打包的小工程,编译出现undefined reference to错误
(75.42 KiB) Downloaded 125 times

greenstone
Posts: 20
Joined: Mon Jul 10, 2023 9:14 am

Re: undefined reference to,链接时总是报这个错误

Postby greenstone » Mon Sep 02, 2024 3:24 am

各位大神,麻烦帮忙看看啊,卡了好久了,也添加了正确的依赖,添加这个组件就链接不了,请问是什么原因?

Who is online

Users browsing this forum: No registered users and 70 guests