undefined reference to when linking
Posted: Tue Sep 03, 2024 2:07 am
Hello everyone, the main component calls a function in component A(wifi_app), and component A calls a function in component B(port_event). Component A has added a dependency on component B to its CMakeLists, but when linking, the function defined in component B cannot be found, prompting an "undefined reference to 'port_clear/get/set_status (EVENT, GROUP, SELECT_T, unsigned long)'. I changed this statement to xEventGroupClearBits/xEventGroupSetBits/xEventGroupWaitBits , There are no issues with compiling and linking. May I ask where the problem lies? Seeking guidance.
Projects with successfully compiled links, such as new1, and projects with problematic compiled links, such as new2
I have compiled on both Ubuntu and Windows environments, and the ESP-IDF versions are 5.1.0 and 5.3.0 respectively (currently not affected), both of which report the same error.
The CakeLists for custom component A (wifi_app) are as follows:
idf_component_register(SRCS "wifi_device.cpp"
INCLUDE_DIRS ". "
REQUIRES freertos esp_system esp_wifi esp_event esp_ringbuf
main_config
port_debug
port_event
hal_param_manage
)
The CakeLists for custom component B (port_event) are as follows:
idf_component_register(SRCS "port_event.c"
INCLUDE_DIRS ". "
REQUIRES freertos esp_system log
)
The CakeLists for component mian are as follows:
idf_component_register(SRCS "user_main.c"
INCLUDE_DIRS ""
REQUIRES)
Projects with successfully compiled links, such as new1, and projects with problematic compiled links, such as new2
I have compiled on both Ubuntu and Windows environments, and the ESP-IDF versions are 5.1.0 and 5.3.0 respectively (currently not affected), both of which report the same error.
The CakeLists for custom component A (wifi_app) are as follows:
idf_component_register(SRCS "wifi_device.cpp"
INCLUDE_DIRS ". "
REQUIRES freertos esp_system esp_wifi esp_event esp_ringbuf
main_config
port_debug
port_event
hal_param_manage
)
The CakeLists for custom component B (port_event) are as follows:
idf_component_register(SRCS "port_event.c"
INCLUDE_DIRS ". "
REQUIRES freertos esp_system log
)
The CakeLists for component mian are as follows:
idf_component_register(SRCS "user_main.c"
INCLUDE_DIRS ""
REQUIRES)