Page 1 of 1

Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Fri Jun 08, 2018 12:26 pm
by Zingemneire
Hi,

I think I have an odd problem in my project.

Within the project I have lots of ' #include "somefile.h" ' lines which reference various ESP-IDF header files, for example to header file "esp_err.h". From the beginning I have a list of various predefined PATHS and SYMBOLS, when I add a reference to another header file that is not in the existing list I simply add another path to the existing list, rebuild the index and things get sorted.

The exception to the rule is instruction ' #include "cJSON.h" '. Although I have added the path to its location ( see second line in the "includes" tab in "Path and Symbols" in the attached image file ) Eclipse stubbornly lists that one as an "Unresolved inclusion". The +/- 20 or so other ones it happily resolves but not that one.
By the way: the project builds just fine both from within Eclipse or from the command line using command "make -j4"

Anyone out there with an idea as to what might be causing this :?:

Re: Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Tue Jun 19, 2018 6:13 am
by Zingemneire
Hi All,

After trawling the internet for an answer to this one the bottom line appears to be that Eclipse sometimes can't cut it. In spite of setting up everything correctly Eclipse sometimes misses a beat here or there. I have solved this one by putting a copy of the "cJSON.h" file in the directory where I make use of the file in my own JSON handling code. For the build it does not make the slightest difference but Eclipse can now handle the inclusion and continues being able to resolve items mentioned within the file. :o

All for now.

Re: Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Tue Jun 19, 2018 6:59 am
by Vader_Mester
Get the same issue over and over and ooooveeeeer again with Eclipse :?

It compiles without issues though :D Although what bugs me with Eclipse is that it is extremely sloooow.
I hope the cmake things better and more compatible with other IDEs.

Re: Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Tue Jun 19, 2018 5:15 pm
by kolban
What language is the program being compiled? C or C++?
What does the actual include of "cJSON.h" look like?

For example:

#include <cJSON.h>

or

#include "cJSON.h"

Re: Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Thu Jun 28, 2018 11:59 am
by Zingemneire
Hi All,

I have been busy with other things the last week so i did not check the forum for answers for a while.

As to the original problem: I had an additional case of the same. in one of my c files i Had to put in this line.

Code: Select all

#include "esp_err.h"  // extra pointless include to allow Eclipse to resolve ESP_OK and ESP_FAIL
As the file builds perfectly file "esp_err.h" is definitely referenced in another include file somewhere so the compiler does find it but for some reason Eclipse can't find it in this file ( although it does find it in many other cases/files without extra include instructions ). In this particular case I have put in the extra include instruction and left it at that.

@Kolban: it definitely compiles with the c compiler. and the include looks like #include "cJSON.h", the extra one and the original one.

@Vader_mester: same here, it does compile directly from Eclipse but that takes a long time, sometimes several minutes in case there is only a single file change. As an alternative I use the simple "make -j8" command in the /mys32/mingw32 shell to build my applications.
The latter is much faster and more efficient. So: use Eclipse for editing and flashing, adding a superfluous but harmless extra include file here and there and use command line based make command to build.

Re: Eclipse problem: can't resolve "Unresolved inclusion" for "cJSON.h" file

Posted: Thu Jun 28, 2018 12:21 pm
by Vader_Mester
Zingemneire wrote:Hi All,

I have been busy with other things the last week so i did not check the forum for answers for a while.

As to the original problem: I had an additional case of the same. in one of my c files i Had to put in this line.

Code: Select all

#include "esp_err.h"  // extra pointless include to allow Eclipse to resolve ESP_OK and ESP_FAIL
As the file builds perfectly file "esp_err.h" is definitely referenced in another include file somewhere so the compiler does find it but for some reason Eclipse can't find it in this file ( although it does find it in many other cases/files without extra include instructions ). In this particular case I have put in the extra include instruction and left it at that.

@Vader_mester: same here, it does compile directly from Eclipse but that takes a long time, sometimes several minutes in case there is only a single file change. As an alternative I use the simple "make -j8" command in the /mys32/mingw32 shell to build my applications.
The latter is much faster and more efficient. So: use Eclipse for editing and flashing, adding a superfluous but harmless extra include file here and there and use command line based make command to build.
I keep doing the same thing. Only problem is that it's sometimes hard to read error notes in mingw shell :D