How does Eclipse find the includes in the esp-idf-template?

clarkster
Posts: 47
Joined: Sat Sep 23, 2017 12:36 pm

How does Eclipse find the includes in the esp-idf-template?

Postby clarkster » Sun Sep 24, 2017 10:57 pm

I have started a new Eclipse project based on the esp-idf-template using the instructions here.

https://esp-idf.readthedocs.io/en/lates ... setup.html

I did not add any other include paths or make any other changes to project properties.

After that was done I found several include paths in the project, all from the xtensa-esp32-elf folder. There were no include paths into the .../esp/esp-idf folder. Based on the include paths that were found, I have a couple questions:

1. How did they get there? Which of the instructions in eclipse-setup.htlm causes those include paths to be part of the project?

2. The esp-idf-template has several includes listed in main.c. Some of them are:
#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_system.h"
Eclipse is able to find all of the includes in main.c. None of them are shown as errors.

How is Eclipse has been able to find these files? All the include paths in the project are in the xtensa-sep32-elf folder and that folder does not contain any of the includes in main.c.

I hope someone that understands how Eclipse works can explain this to me.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How does Eclipse find the includes in the esp-idf-template?

Postby ESP_Angus » Mon Sep 25, 2017 12:44 am

For a "Makefile project" in Eclipse, building is still handled via "make" so all the compiling & linking happens inside make. Eclipse parses make output during the build to learn what paths are added to the header search path, and this is how the IDE itself learns that information for highlighting, automatic completion, etc.

The relevant steps in the setup guide are here:
https://esp-idf.readthedocs.io/en/lates ... properties

The "Build Output Paths" regular expression in the guide is currently wrong and means header paths for C++ source files aren't being parsed properly. If you're compiling .cpp files then please check here:
https://github.com/espressif/esp-idf/pull/1005
(This documentation fix should be merged in the next few days)

Note that some Eclipse setup guides for IDF (not the official one) ignore this "magic" parsing entirely and ask you to explicitly add all of the project include paths to the Project properties. This will also work, with the downside that you have to maintain this list any time you update IDF.

clarkster
Posts: 47
Joined: Sat Sep 23, 2017 12:36 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby clarkster » Mon Sep 25, 2017 1:15 am

Hey ESP_Angus!

Thank you so much for such a prompt reply!

The ESP32 has become my go to processor for small projects. I now no longer see any reason to look at any of the various Arduino boards, maybe not even a Raspberry Pi, for most of my projects. I am becoming a real fan-boy of the ESP32....it has an incredible amount of power and features packed into such a little device. I bet you guys will take over this segment of the market as soon as the word gets out.

However, I have been very frustrated with using Eclipse. I have been having a lot of trouble with Eclipse finding include files. With some projects, Eclipse finds them, and sometimes it doesn't. It's maddening. I've even investigated the other techniques you referenced, and yes they don't always work either and when they do they take a lot of effort to get them working. And I've begin to look at Eclipse alternatives such as VSCode, Atom, and PlatformIO. In the last two weeks I've spent far more time trying to get my development tools to work than I have spent learning to program the ESP32.

Now I sort of understand why I've been having this much trouble -thanks to your explanation. And it also looks like a fix is on the way that will completely end all these problems. Yippee!

Thank you, thank you, thank you for your help. I look forward to seeing the final fix in the next few days.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How does Eclipse find the includes in the esp-idf-template?

Postby ESP_Angus » Mon Sep 25, 2017 2:10 am

Hi clarkster,

I'm glad that's helped you out. Please let us know if it's still not working down the track.

We know it's fiddly and we have devoted some time to exploring better solutions for IDE-based developers. Nothing on the roadmap for release yet, sorry.

Angus

clarkster
Posts: 47
Joined: Sat Sep 23, 2017 12:36 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby clarkster » Mon Sep 25, 2017 2:19 am

Angus

I read your first reply a little closer...is the fix you have coming only for C++ projects?

My current project is a C based project and I'm having problems getting Eclipse to find all the include files.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How does Eclipse find the includes in the esp-idf-template?

Postby ESP_Angus » Mon Sep 25, 2017 2:51 am

clarkster wrote:Angus

I read your first reply a little closer...is the fix you have coming only for C++ projects?

My current project is a C based project and I'm having problems getting Eclipse to find all the include files.
C should work now. I'd start by checking each of the Project Properties mentioned in the guide are set exactly as shown.

Does your project build successfully if you choose Project -> Build Project or Build All?

If it builds OK and you've checked the project properties, try choosing Project -> C/C++ Index -> Rebuild. If still stuck, you may get some clues via opening a problem source file and choosing Project -> C/C++ Index -> Create Parser Log File, choose a path for the log file, then rebuild the project.

clarkster
Posts: 47
Joined: Sat Sep 23, 2017 12:36 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby clarkster » Mon Sep 25, 2017 4:18 am

I figured out what part of my problem was. I was lazy and tried to import settings from one project to another. I found that while I can import settings from one project to another, and after I do this, the project properties appear to be correct, it does not work. There are many include errors.

So far, it appears to me that the ONLY way to set up a project exactly as you described in your web page. No copying of settings from one project to another. You must manually setup the project as you have described. Then, after a clean and build, the includes should all be found.

The good thing is that while this takes a few minutes to manually set up a project, you do not have to spend time manually inserting include paths into the project propertied.

RoyceP
Posts: 7
Joined: Thu Sep 01, 2016 3:46 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby RoyceP » Thu Feb 08, 2018 6:53 pm

I was hoping to get VS Code (sans PlatformIO) or maybe another IDE rolling as far as Intellisense goes. (Building from the cmd line is no big deal. Intellisense or the equivalent is the real value of an IDE IMHO) I gather from this thread that Eclipse is basically reverse engineering the paths from the build output.

I wonder if it would be simpler and easier to have the include paths simply be a target of the makefile. Same for any defines outside the source. That is, "make include_paths" would burp out a delimited list of include paths. "make cpp_defines" would send an delimited list of those defines made outside the source.

That would sure make getting systems going, besides Eclipse, a lot easier.

I would be happy to attempt adding those target myself, but I have to admit I find makefiles fairly opaque. (Pointers or clues welcome)

beatricius
Posts: 1
Joined: Sat Nov 30, 2019 3:36 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby beatricius » Sat Nov 30, 2019 3:44 pm

clarkster wrote:
Mon Sep 25, 2017 4:18 am
I figured out what part of my problem was. I was lazy and tried to import settings from one project to another. I found that while I can import settings from one project to another, and after I do this, the project properties appear to be correct, it does not work. There are many include errors.

So far, it appears to me that the ONLY way to set up a project exactly as you described in your web page. No copying of settings from one project to another. You must manually setup the project as you have described. Then, after a clean and build, the includes should all be found.

The good thing is that while this takes a few minutes to manually set up a project, you do not have to spend time manually inserting include paths into the project propertied.

I was having the same issue with the include errors and then found this thread and realized it is because I am importing configurations from one project to another. I also found that there is actually a way to fix this. You need to point the Indexer in the "C/C++ General" property page to use the correct build configuration. Select either active build configuration (if your imported configuration is set to "Active" in the "C/C++ Build" property page) or use a fixed build configuration and choose the correct one from the drop down menu.

Not sure if you are still looking for a fix for this but maybe it will help someone else who ends up on this thread :)

firmwareguy195
Posts: 1
Joined: Fri Jul 15, 2022 9:55 pm

Re: How does Eclipse find the includes in the esp-idf-template?

Postby firmwareguy195 » Fri Jul 15, 2022 10:17 pm

Hello,

The latest message in this thread is 4 years old. The posted solution does not work. It take you to

https://docs.espressif.com/projects/esp ... properties

which takes you to

https://github.com/espressif/idf-eclips ... tVariables

which describes a whole bunch of Eclipse settings, but doesn't say anything about Include Paths.

Is there a simple way to get the parser to recognize the IDF includes, or do I just have to manually enter them?

Thanks,
David

Who is online

Users browsing this forum: No registered users and 286 guests