Not including Arduino Libaries in .cpp Files

Forum related to ERIKA Enterprise and RT-Druid version 3

Moderator: paolo.gai

Locked
veysel89

Not including Arduino Libaries in .cpp Files

Post 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!
Attachments
3.PNG
3.PNG (36.21 KiB) Viewed 11237 times
2.PNG
2.PNG (53.06 KiB) Viewed 11237 times
1.PNG
1.PNG (68.87 KiB) Viewed 11237 times
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post 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
veysel89

Re: Not including Arduino Libaries in .cpp Files

Post 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?
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post 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
irolokirt

Re: Not including Arduino Libaries in .cpp Files

Post 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.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: Not including Arduino Libaries in .cpp Files

Post 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
Locked