Page 1 of 1

Multipe C files - Update make?

Posted: Fri Mar 16, 2018 5:13 pm
by ocnek1
Hello,
Sorry for the basic question. I've ran through some of the examples with no troubles, but would like to add some of my own functionality in separate c files so I don't have one big long source file. How do go about adding my own files to a project? Do I have to update a make file somewhere?

Sorry for the basic question. Just getting going with the ESP32, but having fun ;)

Thanks,
Oc.

Re: Multipe C files - Update make?

Posted: Sat Mar 17, 2018 3:49 am
by kolban
If you are using the ESP-IDF build system and the template application, you should find a folder called "main" in your project. Create your new source files in that directory with the file suffix of ".c". Now when you run the existing build / make, your new source files will be automatically compiled and linked. It appears that the build system will compile all source files in main that end in .c or .cpp and link them together for you. There is more that can be said on this topic but I'm hoping that this answers the core question.

Re: Multipe C files - Update make?

Posted: Sat Mar 17, 2018 4:06 am
by ocnek1
Hi Kolban.

Thanks for the reply. Yep, looks like you are correct :) I've just added a couple of new .c / .h files and everything seems to link and work OK.

.....well that was easy :o

Yes, I'm just working with the ESP-IDF build system.

Thanks.