Library support for the ISO c++ 2011 standard in omnet - c++

I am using OMNET 4.4. When OMNET compiles it says that
this file requires compiler and library support for the ISO c++ 2011 standard. This support is currently experimental and must be enabled with -std=c++11 or -gnu=c++11 compiler options.
Also following error appears:
/veins/modules/application/traci/TraCITestApp.h:78:36: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
I am using windows 10 and I could not find solution to it in internet .
Can anyone help me with some information ?

First, this warning is not coming up from the build of OMNeT++, but from the build of Veins. It is not the same. OMNeT++ 4.4 builds without C++11 support fine, but it seems that recent versions of Veins may need it. However again, this is a warning. OMNeT++ 4.6 and later can be configured with the -std=c++11.
You may need to update your compiler, too as any recent compiler fully supports c++11 since at least 3 years.

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"

emscripten C++11 with boost support issue

I have an issue when building my C++ project that uses boost in Emscripten as shown on the screenshot, it says that '_Atomic' is a C11 extension however even if i add -std=c++11 or even -std=c11 i am still getting the error, the _Atomic use is defined from boost.
any idea on how to work around on this? reading around it does say that C++11 is already supported in Emscripten.
my setup.
compiler: emscripten/em++ Clang 12.0.8
Why
The message in your screenshot shows:
you are compiling with clang
error: '_Atomic' is a C11 extension [-Werror,-Wc11-extensions]
So clang warns on c11 extensions because it has the diagnostic flag set, and is also configured to fail on warning which leads to your failed compilation.
-Wc11-extensions may have been specified directly in your compilation commands
or indirectly by -Wpedantic (see https://clang.llvm.org/docs/DiagnosticsReference.html#id604)
How to fix
You could specifically deactivate this warning with the -Wno-c11-extensions compiler flag, see this good explanation here on how to do it: https://nelkinda.com/blog/suppress-warnings-in-gcc-and-clang/

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'

can not include std array in dev c++ 5.9

I wanted to include array in DEv C++ 5.9 but it gave an error:
32 2 c:\program files (x86)\dev-cpp\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\c++\bits\c++0x_warning.h [Error] #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.
Is this because of the version of DEV-C++ that I am using or my computer IOS? I used other versions of DEV C++ but since I have a windows 8 on my computer, they did not work on that and I needed to use this version of DEV C++. Any help is appreciated.
Thanks
The error message tells you exactly how to fix the error.
#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
Read your IDE documentation to figure out how to do this or refer to this image.
http://www.cplusplus.com/doc/tutorial/introduction/devcpp/devcpp2.png
In DEV C++ , tools << set the compiler to debug/release << Setting << Code Generation << Language standard(-std) << ISO C++11 or GCC C++11 (whatever you use) << complie your code of std::array using debug/release whatever you used earlier..
Is this because of the version of DEV-C++ that I am using or my
computer IOS?
No, it depends on the C++ compiler version.
As the error says:
This file requires compiler and library support for the ISO C++ 2011
standard.