none
How do I change the value of __cplusplus? RRS feed

  • Question

  • Hi,

    __cpluplus appears as having value 199711L and I need to use the latest support for C++ ISO Standard (at least C++14).

    How can I change this?

    Thanks,

    Juan


    Juan Dent

    Tuesday, March 22, 2016 5:29 PM

Answers

  • Hi,

    __cpluplus appears as having value 199711L and I need to use the latest support for C++ ISO Standard (at least C++14).

    How can I change this?

    Thanks,

    Juan


    Juan Dent

    A given version of Visual C++ (e.g. Visual C++ 2015) does not support different versions of the language. It supports ... what it supports.

    Visual C++ 2015 supports most features of C++11 and many features of C++14. To get the best feature set make sure you have the latest update (currently Update 1, but Update 2 is coming soon).


    David Wilkinson | Visual C++ MVP


    Tuesday, March 22, 2016 8:53 PM
  • Even with Visual Studio 2015 Update 2, __cplusplus is still defined as 199711L.

    I don't exactly know where or what features Visual Studio 2015, with Update 2, is still missing. On Microsoft, in the section, "C++11 Core Language Features: C99", (link), it shows "Partial" support for C++11x features in Visual Studio 2015 Update 2.

    • Marked as answer by Juan Dent Monday, June 20, 2016 7:59 PM
    Monday, June 20, 2016 6:36 PM

All replies

  • Hi,

    __cpluplus appears as having value 199711L and I need to use the latest support for C++ ISO Standard (at least C++14).

    How can I change this?

    Thanks,

    Juan


    Juan Dent

    A given version of Visual C++ (e.g. Visual C++ 2015) does not support different versions of the language. It supports ... what it supports.

    Visual C++ 2015 supports most features of C++11 and many features of C++14. To get the best feature set make sure you have the latest update (currently Update 1, but Update 2 is coming soon).


    David Wilkinson | Visual C++ MVP


    Tuesday, March 22, 2016 8:53 PM
  • Even with Visual Studio 2015 Update 2, __cplusplus is still defined as 199711L.

    I don't exactly know where or what features Visual Studio 2015, with Update 2, is still missing. On Microsoft, in the section, "C++11 Core Language Features: C99", (link), it shows "Partial" support for C++11x features in Visual Studio 2015 Update 2.

    • Marked as answer by Juan Dent Monday, June 20, 2016 7:59 PM
    Monday, June 20, 2016 6:36 PM
  • I know it's an old thread, but all the answers here are not correct, so I'll complete it:

    __cplusplus is not updated in newer versions of VS, because it breaks existing code. To force it to update, you need to define an extra compile flag: /Zc:__cplusplus

    Just open project settings, and under C/C++  --> All Options --> Additional Options, add this flag. This will make __cplusplus have the correct value.

    • Proposed as answer by TheSaw Wednesday, July 17, 2019 10:38 AM
    Wednesday, July 17, 2019 10:37 AM
  • I know it's an old thread, but all the answers here are not correct, so I'll complete it:

    __cplusplus is not updated in newer versions of VS, because it breaks existing code. To force it to update, you need to define an extra compile flag: /Zc:__cplusplus

    Just open project settings, and under C/C++  --> All Options --> Additional Options, add this flag. This will make __cplusplus have the correct value.

    Yes, its an old thread.  However, the answers were correct when written for VS2015.

    According to https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=vs-2019 "The /Zc:__cplusplus option is available starting in Visual Studio 2017 version 15.7, and is off by default.".

    Wednesday, July 17, 2019 11:04 AM