What i've done so far is creating a folder called "components" which inside has a folder representative of what it does, inside that folder there are two folders called "source" and "include" and inside each there are thing1.c and thing1.h respectively.
in resume:
project
├── CMakeLists.txt
├── components
│ ├── lib_for_something
│ │ ├── CMakeLists.txt
│ │ ├── component.mk
│ │ ├── include
│ │ │ └── thing1.h
│ │ └── source
│ │ └── thing1.c
│ └── lib_for_another
│ ├── CMakeLists.txt
│ ├── component.mk
│ ├── include
│ │ └── thing2.h
│ └── source
│ └── thing2.c
├── main
│ ├── CMakeLists.txt
│ ├── component.mk
│ └── main.c
├── Makefile
├── sdkconfig
└── sdkconfig.old
My problem is that when i want to build that i hace the next output:
Code: Select all
Generating esp32.project.ld
LD build/main.elf
/home/$USER/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32
-elf/bin/ld: /home/$USER/project/build/main/libmain.a(main.o):(.literal.app_main+0x48): undefined reference to `function1'
/home/$USER/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32
-elf/bin/ld: /home/$USER/project/build/main/libmain.a(main.o): in function `app_main':
/home/$USER/project/main/main.c:47: undefined reference to `function1'
collect2: error: ld returned 1 exit status
/home/$USER/esp/esp-idf/make/project.mk:543: recipe for target '/home/$USER/project/build/main.elf' failed
make: *** [/home/$USER/project/build/main.elf] Error 1
Thanks