Not including Arduino Libaries in .cpp Files

Forum related to ERIKA Enterprise and RT-Druid version 3

Moderator: paolo.gai

Post Reply
veysel89
Newbie
Posts: 2
Joined: Tue Jul 10, 2018 12:25 am

Not including Arduino Libaries in .cpp Files

Post by veysel89 » Tue Jul 10, 2018 10:00 am

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!
Attachments
3.PNG
3.PNG (36.21 KiB) Viewed 8903 times
2.PNG
2.PNG (53.06 KiB) Viewed 8903 times
1.PNG
1.PNG (68.87 KiB) Viewed 8903 times

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post by paolo.gai » Tue Jul 10, 2018 10:09 am

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

veysel89
Newbie
Posts: 2
Joined: Tue Jul 10, 2018 12:25 am

Re: Not including Arduino Libaries in .cpp Files

Post by veysel89 » 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.

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?

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post by paolo.gai » Mon Sep 24, 2018 9:39 pm

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

irolokirt
Newbie
Posts: 1
Joined: Fri Feb 07, 2020 9:32 pm

Re: Not including Arduino Libaries in .cpp Files

Post by irolokirt » Sun Feb 09, 2020 10:26 am

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.

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post by paolo.gai » Thu Feb 20, 2020 9:53 pm

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

Post Reply