I am a VS user and I wanna find out info regarding to the c++ standard i am using.
i wonder how i can find out if it is c++11 standard or c++98 standard.
MSVC is probably not going to have an updated __cplusplus until more or all of that standard's features are implemented. See the comments on this page for more information.
Instead, use the macros available in Boost.Config to test for specific features. For example, to test whether decltype is supported, you can use:
BOOST_NO_CXX11_DECLTYPE
This will be defined if the compiler does not support decltype. Depending on your version of VS vs. your version of Boost, this might not be 100% up to date. Be sure to check that Boost version for what is supported. As Boost 1.56.0 has had major delays, I am unsure what the current status of VS support is in 1.55.0, but 1.56.0 should arrive pretty soon and I would think it would fix any outstanding issues with recent VS versions.
Related
Is the c++ version you use tied to the version of compiler you have or IDE?
If it isn't either of those, how do I use c++ 11 on my IDE? How do i update what C++ version i use in my programs?
How do I check what version I'm using?
I know that printing the __cplusplus variable can tell me what version I'm using, but this doesn't answer my other questions, neither does it answer my third question, because: https://stackoverflow.com/a/14131551/10938047
Found this question, with the answer containing an outdated link.
Visual Studio 2012 __cplusplus and C++ 11
The C++ version you can use is obviously tied to the compiler you use. If your compiler doesn't support some newer standard then of course you cannot use it.
As for IDEs; some IDEs are tied to a specific compiler, some can use different ones.
Some compilers support multiple language versions but require you to explicitly enable anything newer than what they enable by default. For example; most older versions of GCC support C++17 just fine, but default to C++11 or C++14 unless you tell them to enable C++17 support via the -std=c++17 command line option.
Which Visual Studio Version support C++11, C++14 or C++17?
I assume, that some version do support not all functions, but the question is aimed at the core functions.
Are there any differences between the Community Versions concerning the supported C++ version?
Thanks.
I find that this page should answer your question.
As for the Community Version, it supports the same C++ version as the other versions. The difference is in the tool provided(profiler, static analysis, etc.).
That’s a bit of a tricky question. For GCC/libstdc++ and Clang/libc++ the answer is usually pretty clear along the lines of: “Full support for all C++XX language and library features starting from version X.Y”.
But MSVC even in the very latest version does not have full support for C++11. On the other hand it already has a lot of the features from C++14 and even the upcoming C++17. So the question you’ll have to answer is: Which features do I want/need and from which version are they available? The links from the other question and its comments are a good starting point for this:
Support For C++11/14/17 Features (Modern C++)
Visual C++ Team Blog: C++17 Features In Visual Studio 2017 Version 15.3 Preview. There may be new versions of this blog post for newer VS versions as they are released. Look for posts by Stephan T. Lavavej to find the latest one. He is the maintainer of Microsoft’s standard library implementation.
As a rule of thumb I recommend you always go with the very latest version you can get your hands on. And if that’s not possible you probably don’t want to go older than VS 2015.
Microsoft constantly closes more and more of those older holes in their implementation. So probably and hopefully by C++20 or C++23 the situation will be similar to Clang or GCC.
I am trying to install MongoDB driver and is reading this following section
https://github.com/mongodb/mongo-cxx-driver/wiki/Download-and-Compile-the-Legacy-Driver
SCons Options when Compiling the C++ Driver
Select options as appropriate for your environment. Please note that some flags may not be available on older versions.
Important note about C++11/C++14: The boost libraries do not offer a stable ABI across different versions of the C++ standard. As a result, you must ensure that your application, the C++ driver, and boost are all built with the same language standard. In particular, if you are building the C++ driver with C++11 enabled, you must also build your application with C++11 enabled, and link against a C++11 compiled boost. Note that on most systems, the system or package installed boost distribution is not built with C++11, and is therefore incompatible with a C++11 build of the legacy driver.
Important note about the C++ standard library: Much like the C++11 issues, it is again critical that all three components (your application, boost, and the C++ driver) be built against the same C++ runtime library. You cannot mix components that have linked against libc++ with those that have linked against libstdc++.
Important 26compat Note: If you are using the 26compat branch, the install-mongoclient target is only enabled when the --full flag is provided. Similarly, you must use the --use-system-boost flag when building 26compat.*
My main question, I am trying to find out what standard my visual studio 2015 is running on when I build solution. I have tried to read around but I think I misunderstood the concept of C++11 and C++14. On Microsoft page it mentioned that VS2015 supports C++11,C++14 and C++17. But how do I know what am I using now? I can't find a way to explicitly configure. I am new to C++ and have been coding Java for many years. C++ is confusing to me because there are so many variety such as compilers and standards. Please help me understand and possibly find out what standard I am running.
The text is mostly nonsense.
ABI's are dictated by compilers, not standards. There is no ABI for C++11, there's one for GCC and a different one for MSVC2015.
"C++11 enabled" is a setting on GCC, and it does affect their ABI. The same applies to libc++ versus libstdc++, neither is part of the C++11 standard. Also, the mixing of build environments and the OS ("system Boost version") is mostly a Linux thing.
MSVC++ isn't GCC, and it doesn't use libstdc++, so all this does not affect you. And Boost versions aren't even a MSVC++ setting anymore, for the last few versions library configuration has been a per-project setting instead. (Tip: Create a Boost.vsprops file for that)
Microsoft's (Core) Guidelines Support Library implementation is said to support GCC 5.1 - but does not specify support for other versions. Higher versions seem to be ok (anyway, 5.3.1 on my Debian Stretch) - but building the tests with GCC 4.9.3 fails.
Has anybody else implemented the GSL?
Can I use MS GSL anyway, somehow?
If not, can I use some safe subset of it? (Probably not, I know)
If not, isn't it a problem that only people with newer compilers can have a guidelines support libraries? Even though their older compilers support C++11 or even C++14?
Yes, there is one I know of: gsl-lite.
It worked fine for me so far. But I changed my compiler to a newer version and did not need it anymore.
You can also use (a rather small) subset of Microsofts implementation. If you do not need the span-classes. These are gsl_assert.h (Expects, Ensures) and gsl_utils.h (narrow, final_act, ...). I think I might have adjusted just some constexpr related things.
My compiler supports C++03. Which version of boost should I therefore use? If I was using an earlier version of C++, how would I establish the boost version?
Whichever. Boost libraries are smart enough to detect your C++ version and compiler and with some preprocessor magic provide implementations that will work with it. So you could as well use the latest version which has more bugs fixed and broader functionality.
Every boost version has its "tested compilers" list (scroll this page to the end). This is the place where you should check whether your compiler version is supported or not.