2

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

sepp2k
  • 363,768
  • 54
  • 674
  • 675
k9-primetime
  • 73
  • 1
  • 10
  • You can only ask a single question in a single thread. So please be specific. – Rohan Bari May 31 '20 at 17:16
  • For Visual Studio 2012 it does not even fully support c++11. – drescherjm May 31 '20 at 17:18
  • Does this answer your question? [Where do I find the current C or C++ standard documents?](https://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents) – Richard Critten May 31 '20 at 17:19
  • ***Is the c++ version you use tied to the version of compiler*** Tied to the compiler however Visual Studio comes with an IDE and a compiler. More modern versions of the Visual Studio IDE allow a choice of toolset. One such example is in Visual Studio 2019 I can open a VS 2013 project and have the compiler from VS 2013 build my code. Which is important because some of my older code is incompatible with newer compilers. – drescherjm May 31 '20 at 17:26
  • `__cplusplus` is not reliable. Most versions of MSVC (except very recent versions and usually requiring specific options) default that variable to saying C++98, although the compiler can do much more. – Jesper Juhl May 31 '20 at 17:26

1 Answers1

3

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.

Jesper Juhl
  • 30,449
  • 3
  • 47
  • 70