C++ and Eclipse woes

cool.kolos
Posts: 1
Joined: Wed Dec 20, 2017 12:23 pm

C++ and Eclipse woes

Postby cool.kolos » Wed Dec 20, 2017 1:11 pm

Dear ESP wizards,
I'm really excited to have some fun with ESP32, but so far I've gotten bogged down with the environment setup. By using official "Get Started" guide and a lot of try and error I've managed to convince Eclipse to build a "hello world" example C file without any problems and errors. However since I'm far more versed in C++, I thought I'd start with that before moving to C.
So I've modified the preprocessor compiler setting as stated in the Kolban book, changed the hello world file form main.c to main.cpp and added: extern "C" { int app_main(void); } at the begging. The result is that the project gets build without a hitch, but now those pesky "unresolved inclusion" errors are back! Grrr...
Any ideas how can I make them go away for good?
Thanks!

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: C++ and Eclipse woes

Postby ESP_Angus » Wed Dec 20, 2017 11:51 pm

Hi kolos,

Eclipse setup is pretty fiddly. We're working on ways to make this less painless in the future.

For now, I suggest double-checking all of the items shown in the Project Properties from the setup guide:
https://esp-idf.readthedocs.io/en/lates ... properties

Particularly if the "CDT GCC Build Output Parser" setting is wrong then it's possible CDT is only correctly indexing C files, not C++ files, to find their header paths.

After changing these settings you may need to do a clean build (or at least change something in main.cpp and then build it again) before you see any differences.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: C++ and Eclipse woes

Postby ESP_Angus » Tue Jan 09, 2018 9:07 pm

Hi kolos,

Turns out there was a bug in the build output for C++ which broke Eclipse CDT parsing. The IDF master branch now has the fix, if you update these warnings should go away.

Reference: https://github.com/espressif/esp-idf/pull/1474


Angus

OneTwo
Posts: 20
Joined: Mon Jan 15, 2018 9:24 am

Re: C++ and Eclipse woes

Postby OneTwo » Tue Jan 16, 2018 7:51 am

cool.kolos wrote:Dear ESP wizards,
I'm really excited to have some fun with ESP32, but so far I've gotten bogged down with the environment setup. By using official "Get Started" guide and a lot of try and error I've managed to convince Eclipse to build a "hello world" example C file without any problems and errors. However since I'm far more versed in C++, I thought I'd start with that before moving to C.
So I've modified the preprocessor compiler setting as stated in the Kolban book, changed the hello world file form main.c to main.cpp and added: extern "C" { int app_main(void); } at the begging. The result is that the project gets build without a hitch, but now those pesky "unresolved inclusion" errors are back! Grrr...
Any ideas how can I make them go away for good?
Thanks!
I discoverd that the -std=c++11 compiler flag is missing. Add this to (i belive) :roll:
Command to get compiler specs
and the errors will go away.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 121 guests