Hi all
I'm using eclipse and an esp32 wroom module.
I already setup the environment.
For simple projects like blink example and hello world example it's no problem to build, flash and debug. This works very fine.
Only problem is how to add header and sourcefiles?
As example: I want to write a mathfunction in another file and call the function from main. Eclipse always says that theres no reference. Please see attached files.
Best regards
Christian
How to add header and source files to project
-
- Posts: 2
- Joined: Wed Feb 19, 2020 2:41 pm
How to add header and source files to project
- Attachments
-
- test_header.h
- (190 Bytes) Downloaded 815 times
-
- test_header.c
- (157 Bytes) Downloaded 677 times
-
- main.c
- (98 Bytes) Downloaded 713 times
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: How to add header and source files to project
Hi christian28,
Do you have "CMakeLists.txt" files in your project?
Is "test_header.c" included in "CMakeLists.txt" in your "main" folder?
I think the safest way to start a new project is by going to File > New > Espressif IDF Project. This will set the key files for you. Then add your extra files and update CMakeLists.txt.
Please check https://github.com/espressif/esp-idf/tr ... r/examples how this is done for small typical projects or see formal description in https://docs.espressif.com/projects/esp ... le-project.
Do you have "CMakeLists.txt" files in your project?
Is "test_header.c" included in "CMakeLists.txt" in your "main" folder?
I think the safest way to start a new project is by going to File > New > Espressif IDF Project. This will set the key files for you. Then add your extra files and update CMakeLists.txt.
Please check https://github.com/espressif/esp-idf/tr ... r/examples how this is done for small typical projects or see formal description in https://docs.espressif.com/projects/esp ... le-project.
-
- Posts: 1
- Joined: Sat Mar 06, 2021 1:21 am
Re: How to add header and source files to project
I just experienced a similar issue
Here's what to do to get past it:
Open your CmakeLists.txt file and include this line to the bottom if it is not already there:
Your CMakeLists.txt should look like this now:
NB: Replace main.c, cam.c and sdcard.c in the code above with the names of your source files
Here's what to do to get past it:
Open your CmakeLists.txt file and include this line to the bottom if it is not already there:
Code: Select all
idf_component_register(SRCS "main.c" "cam.c" "sdcard.c"
INCLUDE_DIRS ".")
Code: Select all
# Edit following two lines to set component requirements (see docs)
set(COMPONENT_REQUIRES )
set(COMPONENT_PRIV_REQUIRES )
set(COMPONENT_SRCS "main.c" "cam.c" "sdcard.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
register_component()
idf_component_register(SRCS "main.c" "cam.c" "sdcard.c"
INCLUDE_DIRS ".")
Re: How to add header and source files to project
just got same problem but couldn't fix.
after update like advised i got another error ?
after update like advised i got another error ?
- Attachments
-
- error.png (16.24 KiB) Viewed 12884 times
Who is online
Users browsing this forum: No registered users and 42 guests