M
M
Maxim Siomin2020-07-10 20:35:29
visual studio
Maxim Siomin, 2020-07-10 20:35:29

How to find c++ version?

I am using visual studio. I used to think I was using the latest version of c++ (c++17). But now I'm not sure, I would like to check somehow in the compiler which version of the language I'm using. How can I find out?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Zhilin, 2020-07-10
@MaxSiominDev

MSVC traditionally specifies an obsolete version in __cplusplus, because they didn't implement a two-pass preprocessor for a long time. So only through _MSC_VER.

J
jcmvbkbc, 2020-07-10
@jcmvbkbc

I would like to check somehow in the compiler which version of the language I am using

The predefined macro __cplusplus has a value corresponding to the language version. For example 199711 is C++98 and 202002 is C++20.
std::cout << __cplusplus << std::endl;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question