Reputation: 6285
ALL,
I'm worjking under RHEL 8 with the latest (2021-09) Eclipse version 4.21.0.
I'd like to set a C++ standard to be c++11, since I need a compatibility with the RHEL7.
I tried to follow instructyion I found on a different SO questions but none was sufficient, since many options were removed in this latest Eclipse version.
Could someone please give me a way to set it up for the latest Eclipse release, please?
TIA!!
Upvotes: 1
Views: 1901
Reputation: 21
Here's what worked for me on Eclipse CDT 2024-06. I was using C99, but I don't expect any differences for C11. I previously used Option 2/3, but reading some of the comments lead me to Option 1, which is my preference now. The advantage of Option 2/3 is that it is less restrictive than Option 1, which (on my installation at least) only allows choosing C90, C99 and C11
Project->Properties
C/C++ Build->Tool Chain Editor
Display compatible toolchains only
Linux GCC
CDT Internal Builder
Apply and Close
button in the bottom right (This is important! The necessary tabs will be missing if the menu is not closed)Project->Properties
againC/C++ Build->Settings
Tool Settings
tab within the settings windowGCC C Compiler->Dialect
within the tabISO C11 (-std=c11)
Project->Properties
C/C++ General->Preprocessor Include Paths, Macros etc.
Providers
tabCDT GCC Built-in Compiler Settings
option if it is unchecked, and select it otherwise (Cygwin or MinGW suffix may be required depending on the installation, I cannot say for sure though)-std=c11
as an argument before "${INPUTS}"
(Assuming this was previously unchanged, the text should now be ${COMMAND} ${FLAGS} -E -P -v -dD -std=c11 "${INPUTS}"
Apply and Close
button in the bottom rightWindow->Preferences
C/C++->Build->Settings
Discovery
tab within the settings windowCDT GCC Built-in Compiler Settings
(Again, the Cygwin/MinGW suffix may be required depending on installation)-std=c11
as an argument before "${INPUTS}"
(Assuming this was previously unchanged, the text should now be ${COMMAND} ${FLAGS} -E -P -v -dD -std=c11 "${INPUTS}"
Apply and Close
button in the bottom rightNow the global default is setup, this is all you need to do for each project:
Project->Properties
C/C++ General->Preprocessor Include Paths, Macros etc.
Providers
tabCDT GCC Built-in Compiler Settings
option if it is unchecked, and select it otherwise (Again, the Cygwin/MinGW suffix may be required depending on installation)Apply and Close
button in the bottom rightUpvotes: 0