'nullptr' was not declared in scope [duplicate] - c++

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.

Related

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.

Which C++ standard for I have for g++ compiler?

I work on the Code::Blocks IDE but I'm currently planning to use Sublime editor + some compiler.
In C: B, I have the MinGW g++ compiler (not sure of the version).
How do I know which C++ standard (14 or 11 or the previous ones) I'm using? Also, how do I change the C++ standard and get the one I want? (I need 14 actually). Please tell for both C::B and when I'm installing the compiler separately for Sublime.
C++14 should be the default for GCC since version 6.0. Before 6.0, the default is C++98. Open a command prompt and type g++ --version to see your version.
To change the version flag, go to Settings -> Compiler (or something like that) and look at the list of compiler flags. Check the one that looks like "Have g++ follow the ISO ... C++14 standard".
For other IDEs, find the compiler/build settings, which might or might not be separate for each project, look through them, and select the standard. The flag for it is --std=c++14 by the way.
This might help.

Can Eclipse be configured to support C++14?

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?

C++11 support in NativeLibrary for Android

I'm trying to create a native library in C++, which I can use in Android.
I've created a project in Visual Studio 2017: Dynamic Shared Library (Android), and added my cpp code.
Though some of the code is running C++11, and I'd really like to keep it that way.
When I compile, I get the error:
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.
So I first tried going to Project->Properties->C/C++->Language->C++ Language Standard, and set the options as following:
'
When I compile now, I get exactly the same error. So I tried manually adding the -std=c++11 flag under additional options, though still getting the error.
Why is the compiler not willing to compile using the ++11 standard, and what can I do to fix this? I know it's experimental, but it should at least try to compile.
Best regards
The problem was solved, when I changed the settings to be for All Platforms, and not just ARM.

codeblocks shows error: This file requires support for the ISO C++ 2011 standard

I want to use poisson_distribution template in my C++ code (included in random header), but cant find a way to compile it without error
My codeblocks shows an error
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.
I remember while installing codeblocks I installed only gnu c/c++ compiler. Can anyone explain me how to update my compiler to standard ISO C++ 2011 standard or suggest an alternative.
Thanks in advance...
You don't need to update the compiler. You just need to set it to C++11 mode.
How can I add C++11 support to Code::Blocks compiler?
A simple option would be to write
-std=c++11
As part of the other compiler options flags or directly in your Makefile.
Note that some projects may require -std=gnu++11 which is like C++11 but has some GNU extensions enabled.
Settings > Compiler >
select the checkbox:
'Have g++ follow the C++11 ISO C++ language standard'