Page 1 of 1

Not including Arduino Libaries in .cpp Files

Posted: Tue Jul 10, 2018 10:00 am
by veysel89
Hello Guys,

Im not a native speaker, I hope my problem is understandable and someone can resolve my problem. I followed the Arduino UNO Tutorial for the ERIKA3 GH40 release, but getting error messages caused by missing includes (arduino.h)

I found out, that the include of the "Arduino.h" only works, if the Source File is a C Source File (not .cpp). But when I renaming it to .c, all C++ libaries stop working.

In Image 1. you can see the Error Messages.
In Image 2. you can see, that I set the Arduino Path in the OIL Settings.
In Image 3. you can see, that the Arduino Libaries are added under Path and Symbols (Project Settings, C/C++ General Setting)

I have noticed, that under Path and Symbols in the C/C++ General Setting only GNU C is listed under Languages. Isn't the GNU C++ missing and causing that problem?

Thank you for your Help!

Re: Not including Arduino Libaries in .cpp Files

Posted: Tue Jul 10, 2018 10:09 am
by paolo.gai
Dear anonymous,

Note that the red errors in Eclipse are due to the fact that Eclipse does not have all the include paths. The code compiles also if Eclipse has a few red marks.

It seeems you installed arduino not in teh default directory, but should not be an issue.

Did you try to build the project? the error list you showed is the one of eclipse, not of the compilation execution.

Ciao,

PJ

Re: Not including Arduino Libaries in .cpp Files

Posted: Tue Jul 10, 2018 10:44 am
by veysel89
I can compile without errors, build the code and also flash it to the UNO and read the serial output through putty. But with all the errors and missing includes changing the template is a pain.

I also tried the VM Version and followed all the Instructions...got the same Errors. Do you have the GNU C++ Language under C/C++ General Settings/ Path and Symbols or just the GNU C like in my Picture?

Re: Not including Arduino Libaries in .cpp Files

Posted: Mon Sep 24, 2018 9:39 pm
by paolo.gai
well... the image you posted has the Arduino SDK ponting to a workspace directory. The one I have is the location of the Arduino installation.

PJ

Re: Not including Arduino Libaries in .cpp Files

Posted: Sun Feb 09, 2020 10:26 am
by irolokirt
hi everyone.

let me exhume this post.
veysel89 wrote:
Tue Jul 10, 2018 10:00 am

In Image 1. you can see the Error Messages.
In Image 2. you can see, that I set the Arduino Path in the OIL Settings.
In Image 3. you can see, that the Arduino Libaries are added under Path and Symbols (Project Settings, C/C++ General Setting)

I have noticed, that under Path and Symbols in the C/C++ General Setting only GNU C is listed under Languages. Isn't the GNU C++ missing and causing that problem?

Thank you for your Help!
i've found the same problem, i've correctly set the path of arduino SDK but actually the problem seem due to the missing of GNU C++ in the project languages.
in fact the "unresolved inclusion" error don't appear in .c files, just in .cpp files.
someone know how do solve this, or how to add GNU C++ in the languages list?
do you have GNU C++ in your projects language as veysel89 asked?

the real problem is actually this:
veysel89 wrote:
Tue Jul 10, 2018 10:44 am
I can compile without errors, build the code and also flash it to the UNO and read the serial output through putty. But with all the errors and missing includes changing the template is a pain.

Re: Not including Arduino Libaries in .cpp Files

Posted: Thu Feb 20, 2020 9:53 pm
by paolo.gai
Let me better understand...

1- when you compile the system builds the executable and you are able to flash it (which means the system works)

2- the issue is more related to the fact that the Eclipse CDT does not find all the includes you are using, neither the official Arduino ones, so the editor signals "false positive"s errors (Note that this point will not be corrected in the short term unfortunately, it highly depend on the toolchain)

Is this analysis correct?

PJ