Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Setting C++ standard
Setting C++ standard [message #1836830] Fri, 15 January 2021 03:51 Go to next message
Igor Korot is currently offline Igor KorotFriend
Messages: 4
Registered: January 2021
Junior Member
Hi, ALL,

In the new Eclipse (2020-12), what is the proper way to set the "-std=c++11" option so that the parser properly picks up the headers?

Thank you.
Re: Setting C++ standard [message #1836857 is a reply to message #1836830] Fri, 15 January 2021 17:47 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You need to add -std=c++11 to the compiler built-ins provider command in
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Providers tab

The newer g++ compilers automatically comply with C++14 and higher
so, unless you want to restrict things to C++11, you don't need to do anything.

You can check it by executing with a terminal:
gcc -x c++ -E -P -v -dD /dev/null | grep cplusplus

c++11 value is 201103

if the value is greater than that you should be OK.
Re: Setting C++ standard [message #1836858 is a reply to message #1836857] Fri, 15 January 2021 18:18 Go to previous messageGo to next message
Igor Korot is currently offline Igor KorotFriend
Messages: 4
Registered: January 2021
Junior Member
Hi,
Where exactly and how should I add it?

Thank you.
  • Attachment: eclipse.png
    (Size: 138.26KB, Downloaded 59 times)
Re: Setting C++ standard [message #1836860 is a reply to message #1836858] Fri, 15 January 2021 18:27 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Providers tab --> CDT GCC Built-in Compiler Settings
Change the command in the edit box labelled "Command to get compiler specs:"
e.g,
change ${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"
to ${COMMAND} ${FLAGS} -std=c++11 -E -P -v -dD "${INPUTS}"
Re: Setting C++ standard [message #1836862 is a reply to message #1836860] Fri, 15 January 2021 19:21 Go to previous message
Igor Korot is currently offline Igor KorotFriend
Messages: 4
Registered: January 2021
Junior Member
Thank you.
It worked.
Previous Topic:GTK Critical
Next Topic:Eclipse CDT C++ Aggregate (brace) Initialization fails with newer eclipse Versions
Goto Forum:
  


Current Time: Sat Oct 05 16:06:13 GMT 2024

Powered by FUDForum. Page generated in 0.03663 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top