0

I am programming a matter device under esp32 with the esp-idf and esp-matter SDK on VSCode and I am using an ESP32-C3.

I am trying to add a custom component that reads the values of a temperature and humidity sensor (SHT40 sensor) to the ligth_switch application.

However, I encounter an error when linking the .elf file. You will find below the error as well as the CMakeLists.txt in the component and in the main folder.

ERROR :

app_driver.cpp:322: undefined reference to `sht40_get_temperature_humidity(sht40_t*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed. 

CMakeLists.txt in components/sensor_sht40/

idf_component_register(SRCS "sensor_sht40.c"
                    INCLUDE_DIRS "include"
                    REQUIRES driver)

CMakeLists.txt in main folder

set(PRIV_REQUIRES_LIST device esp_matter esp_matter_console app_reset sensor_sht40)

idf_component_register(SRC_DIRS          "."
                      PRIV_INCLUDE_DIRS  "."
                      PRIV_REQUIRES      ${PRIV_REQUIRES_LIST})

set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")

0 Answers0