Page 1 of 1

C++ and Eclipse woes

Posted: Wed Dec 20, 2017 1:11 pm
by cool.kolos
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!

Re: C++ and Eclipse woes

Posted: Wed Dec 20, 2017 11:51 pm
by ESP_Angus
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.

Re: C++ and Eclipse woes

Posted: Tue Jan 09, 2018 9:07 pm
by ESP_Angus
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

Re: C++ and Eclipse woes

Posted: Tue Jan 16, 2018 7:51 am
by OneTwo
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.