Using a modified version of the unit test example with the file structure looking like this:
I get the following error:
Code: Select all
/Users/user/esp/esp-idf/tools/unit-test-app/build/hub_test/libhub_test.a(test_mean.o):(.literal.test_func_16+0x0): undefined reference to `testable_mean'
/Users/user/esp/esp-idf/tools/unit-test-app/build/hub_test/libhub_test.a(test_mean.o): In function `test_func_16':
/Users/user/projects/unit_test/components/hub/test/test_mean.c:19: undefined reference to `testable_mean'
/Users/user/esp/esp-idf/tools/unit-test-app/build/hub_test/libhub_test.a(test_mean.o): In function `test_func_22':
/Users/user/projects/unit_test/components/hub/test/test_mean.c:25: undefined reference to `testable_mean'
/Users/user/esp/esp-idf/tools/unit-test-app/build/hub_test/libhub_test.a(test_mean.o): In function `test_func_32':
/Users/user/projects/unit_test/components/hub/test/test_mean.c:35: undefined reference to `testable_mean'
collect2: error: ld returned 1 exit status
test_mean.c is including the file like this:
Code: Select all
#include "../../../main/testable.h"
and CMakeLists.txt has the following information:
Code: Select all
set(COMPONENT_SRCDIRS "../../main")
set(COMPONENT_ADD_INCLUDEDIRS "../../main")
register_component()
Is there anything else I should be doing differently?