Esp-idf: Eclipse on Windows shows Errors due to failing to find all header paths (build succeeds in background) (IDFGH-1059)

Created on 19 Sep 2016  路  34Comments  路  Source: espressif/esp-idf

Hey Team,

The Toolchain for Windows: Quick Steps works for me and I am able to compile the Getting Started project without any issues or tweaking standard configuration.

Then I have installed from scratch and configured Eclipse following instructions in Setting up Eclipse.

This one did not work for me out of box:
unresolved-inclusion

To fix this issue I have entered:
unresolved-inclusion-resolved

Did I miss something in installation process or this is intended / obvious user should add this missing include path? Or maybe it should be added somewhere else?

Bug

Most helpful comment

I'm not sure if this is your exact problem, but: I just setup eclipse, the extra thing I had to do that was not included in the official setup instructions was under C/C++ general, under the "Paths and Symbols", I had to add:
${IDF_PATH}/components/esp32/include
${IDF_PATH}/components/newlib/include
${IDF_PATH}/components/freertos/include
${IDF_PATH}/components/nvs_flash/include
${IDF_PATH}/components/driver/include
${IDF_PATH}/components/log/include
Set the last one with a "workspace" checkbox, replace esp-idf-template with your project folder name
/esp-idf-template/build/include
Hope that this helps!

All 34 comments

Thanks for reporting this with so much detail.

There is an issue on Windows with Eclipse CDT parsing output from the build, that causes these errors. We're working on a solution.

In the meantime, you should find that Project -> Build works despite the errors (the errors are caused by the IDE parsing output from the build for its internal information about where the header files are, not by the building itself.)

Will update this Issue when we have a fix.

@projectgus, thank you for quick review and providing the issue background. Project build is indeed successful (seeing the errors I did not think about checking the "Console" tab). I was not aware that Eclipse has such "split personality".

I like Eclipse for being able to flag issues before I even think about building a project. On the other hand I do not like false, distracting alarms. Therefore, before the fix is identified, I will keep additional path in the "Include directories" so bogus errors are not reported.

I have also problems with includes and symbols. Following the instructions in Setting up Eclipse gave me exactly the result which @krzychb also had.

`#include "freertos/FreeRTOS.h"

include "freertos/task.h"`

... is now included manually by the project properties.

screenshot

For me, as a beginner:
What have I to do, that a compilation the code will success in Eclipse?
How can I update the Index in Eclipse?
-> I want to open the function esp_restart(); with pressing F3..

I am afraid, I do not see this issue fixed with a14bef8f8a854be557d40c893af513f963e1cac4 and the latest toolchain.

Within the same installation, if I checkout branch bugfix/eclipse_windows_paths, and try again, the issue is gone. If I go back to master, it is back.

I'm not sure if this is your exact problem, but: I just setup eclipse, the extra thing I had to do that was not included in the official setup instructions was under C/C++ general, under the "Paths and Symbols", I had to add:
${IDF_PATH}/components/esp32/include
${IDF_PATH}/components/newlib/include
${IDF_PATH}/components/freertos/include
${IDF_PATH}/components/nvs_flash/include
${IDF_PATH}/components/driver/include
${IDF_PATH}/components/log/include
Set the last one with a "workspace" checkbox, replace esp-idf-template with your project folder name
/esp-idf-template/build/include
Hope that this helps!

Thanks, @Bendito999. Yes, this is the problem and it affects Windows users. The good news is that there are vistas to get it fixed. Solution has been prepared by @projectgus in bugfix/eclipse_windows_paths. In the meantime there is another workaround provided by @motla in https://github.com/espressif/esp-idf/pull/157#issuecomment-267269741

@krzychb but I have the same issue on Linux. Includes are not recognised by Eclipse unless I add them manually.

The issue is not resolved for C++ files, as suggested pattern:

xtensa-esp32-elf-(g?cc)|([gc]++)|(clang)

doesn't match "xtensa-esp32-elf-c++". The existing matcher should be wrapped with additional group:

xtensa-esp32-elf-((g?cc)|([gc]++)|(clang))

See: https://github.com/espressif/esp-idf/pull/1005

@dziekon We can probably treat #1005 as a separate issue (as it's a C++-specific not Windows-specific problem). The fix in that PR should be merged soon.

I still have the same problem on Eclipse Oxigen for Mac OS X (using C++). I've tried to modify the compiler command pattern as suggested from @dziekon and to add the the several paths suggested by @Bendito999 but the "freertos/FreeRTOS.h" and "freertos/task.h" are still unresolved in my project..

@fralomb. I suggest to open a separate issue and indicate in the title that the issue concerns C++, Mac OS X and Eclipse Oxigen. This should focus the attention of C++ / Mac OS X users that may face similar issue. Also, have you tried to do Index > Rebuild from the context menu of the affected project?

I think this issue is still here, I am running Ubuntu on a virtual machine. I followed the current instructions for building an Eclipse environment, but have Unresolved inclusion errors even though it compiles OK.

unresolved

I can confirm the error is still there,
after following the setup guide word for word, eclipse is still marking the inclusions as unresolved whilst the build itself works just fine.

image

Hello i can confirm the same issue as @ronald245, i used the exact same procedure as described on the official ESP-IDF eclipse guide and also followed the instruction to add the includes .
I am running the latest eclipse on OSX and still have the issue that all includes are shown as unresolved. I can still build and flash the project, even if all includes show as unresolved.

I cant tell where the issue is but i have eclipse on Ubuntu 14.10 (vbox) and 3 or 4 different workspaces, from which only one does not have issue with indexing included header files. I have no freaking idea what did i do to make it work, because every next workspaces cant find and index header files even if there is no issue with compiling app.

I see this issue occasionally. If I see it then use "Index > Rebuild" and it is gone.

image

running on windows 10
eclipse oxygen
C:/esp32/pcb/espressif-master/esp32/app/ESP32_ble_UART/main/bta_api.h:28:23: fatal error: bt_target.h: No such file or directory
compilation terminated.

please help i have included all files and bta_api is present in path

Hello community,

I've facing a problem with libraries in the Windows enviroment yet.

I've followed each step from link below (esp-idf guide for eclipse using windows):

https://esp-idf.readthedocs.io/en/latest/get-started/eclipse-setup-windows.html#eclipse-windows-setup

And even so I can't use eclipse normally.

Then I tried the method explained in the link:

https://github.com/espressif/esp-idf/pull/157#issuecomment-267269741

It worked for the most of errors but now some variables can't be found, see:

problem

Please, someone have an idea how to proceed ? Or even something that I could check ?

Could be something with toolchain path ?

PS: I can build and flash projects normally, the unique problem is that my eclipse can'ts recognize libraries.

=(

Thank you !

It seems to me that after 3 years the issue is still there.
Eclipse 4.11 on Ubuntu 18.04.2 VM. I followed the get-started guide. Includes are resolved in the main.c file but not in other files.

eclipse
this is the quick fix: do that in GNU C++ tab

Same issue is still there.
Capture

Hi @sabbiolino80 @bonmotwang ,

Please check carefully that all of the Project Properties are set exactly as described here:
https://docs.espressif.com/projects/esp-idf/en/stable/get-started/eclipse-setup.html#project-properties

If any of the environment variables, "Providers", or "Indexer" settings are wrong then the build may succeed but Eclipse won't be able to parse the build output to learn the include paths for each source file.

If changing any of these options, you may need to do a clean build and then possibly rebuild the Eclipse index in order to see any update in the editor window.

@projectgus I did all the steps you mentioned before posting

@sabbiolino80 Could you zip up the .cproject and .project files, and the .settings directory from your IDF project and attach the zip file to the issue? There shouldn't be anything more sensitive than path names in these files.

I have this problem also. Sometimes adding an explicit library paths helps, sometimes not.
From the console I notice that when it can't find a file the path to the workspace has been changed to all lower case letters as below:

In file included from c:\users\andreas\eclipse-workspace_old\wm42e\components\async-mqtt-client\src\asyncmqttclient.h:4:0,
from C:/Users/Andreas/eclipse-workspace_old/WM42E/main/WM42E.cpp:17:
c:\users\andreas\eclipse-workspace_old\wm42e\components\async-mqtt-client\src\AsyncMqttClient.hpp:21:37: fatal error: AsincMqttClient/Flags.hpp: No such file or directory
compilation terminated.
make[1]: * [/home/Andreas/esp/esp-idf/make/component_wrapper.mk:286: WM42E.o] Error 1
make[1]: Leaving directory '/c/Users/Andreas/eclipse-workspace_old/WM42E/build/main'
make: *
[C:\msys32\home\Andreas\esp\esp-idf/make/project.mk:530: component-main-build] Error 2
"make all" terminated with exit code 2. Build might be incomplete.

Hi @sabbiolino80,
I experienced the same issue time ago. The only way that fully worked for me was adding a specific make target for the compiler settings provider.

1) My additional makefiles:
https://secure.dsplabs.net/Cloud/s/SqpSHJP7F853HRX

2) Append in your project makefile:
"include /c/MyPrj/batch/espidfSettingsTarget.mk"
(change the path to your proper location)

3) In Eclipse Project settings, enable the "CDT GCC Built-in Compiler Settings" and set the command:
"python ${IDF_PATH}/tools/windows/eclipse_make.py getsettings --silent 'V=' 'SPECSFILE=${INPUTS} '"

4) Disable any output parser from the project provider list

I hope that it could be useful to you (I never tested it with a new project by the latest ESP-IDF framework)
Regards

EDIT:
I forgotten a point.
5) Make sure that the main component source directory is included as "source location" in the project settings to allow a correct final job by the indexer.
Files at the link updated (@akotowski). Obsolete and misleading comments removed.

Hi @dsptech:
Your fix works!
Thank you very much!
Andy Kotowski

Hi @akotowski ,
I'm glad to hear that. Thank you for the feedback.
Regards.

I'm not sure if this is your exact problem, but: I just setup eclipse, the extra thing I had to do that was not included in the official setup instructions was under C/C++ general, under the "Paths and Symbols", I had to add:
${IDF_PATH}/components/esp32/include
${IDF_PATH}/components/newlib/include
${IDF_PATH}/components/freertos/include
${IDF_PATH}/components/nvs_flash/include
${IDF_PATH}/components/driver/include
${IDF_PATH}/components/log/include
Set the last one with a "workspace" checkbox, replace esp-idf-template with your project folder name
/esp-idf-template/build/include
Hope that this helps!

That's the excellent solution!!!
Thanks mate!

I am working on HFP code which includes some libraries from Bluedroid folder in components section. Now I have changed component specific configs from make menuconfig as suggested by few of the discussions on ESP ADF/IDF github issues but still the problem hasn't solved completely. Although linker started linking few of the Bluedroid components it's not able to link all. So what configs should I use in that case to run HFP? The actual error is common/target.h no such file or directory
ADF-Location
hfp_logs.txt
IDF_Location
Make_Menuconfig_1
Make_Menuconfig_2

I am attaching my logs for reference and directories path, menuconfig screenshots and profile.d. I am quite sure that the paths are set right cause I am able to compile and run demo codes. Let me know if you need any more info about the issue. Thanks once again.

Hi to all
I was able to fix this by changing the path style in the export_idf_path.sh and export_adf_path.sh from "C:/msys32/home/user-name/esp/esp-idf" to "/c/msys32/home/user-name/esp/esp-idf".
Screenshot_1

Also, I made the same in the project setting, I changed the style in IDF_PATH and ADF_PATH from "C:\msys32\home\user-name\esp\esp-idf" to "c:\msys32\home\user-name\esp\esp-idf".
Use the lowercase "c" character instead of uppercase "C"
Screenshot_2

I was checking this for all my projects which had this issue before:

  1. Change the path style
  2. Clean project
  3. Build project

After those 3 steps, all "include" error disappears.
Screenshot_3

Maybe it will help someone.

Try to do all in this topic.
In the end got last errors:

Field 'cores' could not be resolved
Field 'features' could not be resolved
Function 'BIT' could not be resolved

Oh, could anybody help with idea?
image

Check this mark in the project settings.
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kylefelipe picture kylefelipe  路  3Comments

luc-github picture luc-github  路  4Comments

okasha55 picture okasha55  路  3Comments

beriberikix picture beriberikix  路  3Comments

LosDeiblos picture LosDeiblos  路  4Comments