Can Eclipse be configured to support C++14? - c++

Forgive me if this is trivial, but I'm trying to get back to C++ after a long time and am having trouble configuring Eclipse Oxygen 4.7.1a to support C++14. Is it possible to enable C++14 support in Eclipse at all?
The April 2017 Eclipse newsletter states that "CDT's support for C++14 is a work in progress", but I don't know if this still holds.
Here's what I tried. Under File → Properties → C/C++ Build → GCC C++ Compiler → Dialect, there's a built-in setting where I set Language standard to ISO C++1y (-std=c++1y), but this doesn't seem to help as even features such as std::shared_ptr are not recognized by Eclipse. I tried entering -std=c++14 into Other dialect flags, but to no avail. I also tried the proposed solutions in this answer, but again with no success.
I have gcc 5.4.0.
Is it possible to get C++14 working with Eclipse Oxygen?

Related

Do any compilers currently support C++20?

I purchased a book recently entitled beginning C++20. I was looking to begin learning c++ though I now realize that I can't find a compiler that can run the code in the book as I get an error since the compiler I'm using (xcode) does not support c++ 20. I'm wondering if there are any compilers that I can run on my mac that support c++20.
gcc version 8 and up supports some of C++20; you can try using that.
It should also be noted that Xcode isn't a compiler, but instead an IDE that should be using clang as the actual compiler. Clang also currently has support for some of the C++ 20 features. To use them the -std=c++20 flag will still be needed.
Here can you find the currently implemented feature support of the GCC compiler of the C++20 specification:
GCC Link
But you need to enable it in your console command or add this to your toolchain: "-std=c++20"

Eclipse CDT C++20 Support

is there a way to enable support of C++20 features in Eclipse 2020-03 (CDT 9.11)? I mean to get rid of incorrect syntax highlighting like igroring newly added keywords like 'concept', 'requires' and others as defined in C++20 standard? I have a GCC10 supporting those stuff installed and in usage, so the code is built without any troubles but Eclipse CDT still complains about it...
Thanks to anyone willing to advise. Martin
There's no support for C++20 in Eclipse CDT. Actually the support to C++17 is quite high but not totally completed yet. If you need C++20 support is better to use another IDE at the moment or implement the support in CDT if you want.

Why won't Dev-C++ allow me to use std::list? [duplicate]

I am just learning how to write range based for loops, but the only problem is that my compiler, Orwell Dev-C++ doesn't seem to support it in its default mode (which is c++98). How can I change this mode to another one that supports this feature (and other features of C++0x). Thanks. Also:
This was the error message: [Error] range-based-for loops are not allowed in C++98 mode
I run Windows 8
The version I have of Dev C++ is 5.3.0.3
And the compiler is TDM-GCC 4.6.1 64 bit.
Thanks to everyone
Go to Tools -> Compiler Options -> "Compiler" tab
Check the checkbox labeled, "Add the following commands when calling the compiler"
And add in the text entry box, "-std=c++11" or if that doesn't work "-std=C++0x"
Should be something like that anyway, I haven't had Dev C++ installed for many years, so I had to look at some screenshots on Google to remember.
Download from the following link
http://orwelldevcpp.blogspot.in/2015/04/dev-c-511-released.html
Go to Tools->Compiler Option->Programs
and add -std=c++11
see the image
In Dev C++ 5.2.0.3 it's as simple as go to Tools->Compiler Options->Settings->Code Generation
and setting Language standard (-std) to ISO C++11
By default, support for the most recent version of C++ is not enabled. It shall be explicitly enabled by going to:
Here, select the "Settings" tab, and within it, the "Code Generation" tab. There, in "Language standard (-std)" select "ISO C++ 11":
Ok that. You are now ready to compile C++11!
Was facing the same issue in Code::Blocks. to fix the problem, in Build Options->Compiler Flags, tick the box "Have g++ follow the c++11 ISO C++ language standard [-std=c++11]"
In Dev-C++ 5.11 an error comes in new tab like this:
This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
For this you have to follow four simple steps:
Go to Tools Tab
Select Compiler Options..
Go to General tab
Check the checkbox named "Add following commands when calling the compiler", write this statement -std=c++11, and then press OK
Conclusion: Error is removed
Tested On: Dev-C++ 5.11
if you want to code with c instead of c++ and have this issue, do these steps:
Tools > Compiler Options > Settings Tab > Code Generations
set the "Language standard (-std)" to "ISO C99"
you still get the warning although it works for you now.

'nullptr' was not declared in scope [duplicate]

I am just learning how to write range based for loops, but the only problem is that my compiler, Orwell Dev-C++ doesn't seem to support it in its default mode (which is c++98). How can I change this mode to another one that supports this feature (and other features of C++0x). Thanks. Also:
This was the error message: [Error] range-based-for loops are not allowed in C++98 mode
I run Windows 8
The version I have of Dev C++ is 5.3.0.3
And the compiler is TDM-GCC 4.6.1 64 bit.
Thanks to everyone
Go to Tools -> Compiler Options -> "Compiler" tab
Check the checkbox labeled, "Add the following commands when calling the compiler"
And add in the text entry box, "-std=c++11" or if that doesn't work "-std=C++0x"
Should be something like that anyway, I haven't had Dev C++ installed for many years, so I had to look at some screenshots on Google to remember.
Download from the following link
http://orwelldevcpp.blogspot.in/2015/04/dev-c-511-released.html
Go to Tools->Compiler Option->Programs
and add -std=c++11
see the image
In Dev C++ 5.2.0.3 it's as simple as go to Tools->Compiler Options->Settings->Code Generation
and setting Language standard (-std) to ISO C++11
By default, support for the most recent version of C++ is not enabled. It shall be explicitly enabled by going to:
Here, select the "Settings" tab, and within it, the "Code Generation" tab. There, in "Language standard (-std)" select "ISO C++ 11":
Ok that. You are now ready to compile C++11!
Was facing the same issue in Code::Blocks. to fix the problem, in Build Options->Compiler Flags, tick the box "Have g++ follow the c++11 ISO C++ language standard [-std=c++11]"
In Dev-C++ 5.11 an error comes in new tab like this:
This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
For this you have to follow four simple steps:
Go to Tools Tab
Select Compiler Options..
Go to General tab
Check the checkbox named "Add following commands when calling the compiler", write this statement -std=c++11, and then press OK
Conclusion: Error is removed
Tested On: Dev-C++ 5.11
if you want to code with c instead of c++ and have this issue, do these steps:
Tools > Compiler Options > Settings Tab > Code Generations
set the "Language standard (-std)" to "ISO C99"
you still get the warning although it works for you now.

Eclipse Luna Indexer for C++14 with custom makefile

I currently have a C++ project with a custom makefile. I tell eclipse to simply call make and the makefile handles everything. The project builds fine but eclipse keeps highlighting generalized lambda captures as "syntax errors". As far as I understand from this:
https://stackoverflow.com/a/835019/4076418 ,
it's a problem with the CDT Indexer not understanding the C++14 syntax.
I've tried following the answers here:
Eclipse CDT C++11/C++0x support
https://stackoverflow.com/a/13635080/4076418
but they don't handle my case which is Eclipse Luna + a custom makefile project + c++14.
This question is probably related to mine but it has no answer [I also don't have the ability to change the indexer]:
https://stackoverflow.com/q/24950192/4076418
Any ideas on how to get the indexer to recognize c++14 features?
P.S. C++11 features aren't highlighted as syntax errors for some reason. I should also note that I'm using clang 3.4.2 in the makefile; obviously, it supports c++14. The g++ version available though is 4.4.7 so it doesn't support c++14. Could this be the problem somehow? That the CDT uses the system's g++ for the indexer? And if so, how do I change that without having to update g++ (I'm working with limited user privileges and updating it would be a pain)?
AFAIK Eclipse Luna does not support C++14 overall. You will probably need to upgrade to Eclipse Neon. I use neon, the parser works, I don't use custom makefile though
I have used Luna in the past, but even C++11 support was sometimes hard to setup.