Visual Studio: how to check used C++ platform toolset programmatically

后端 未结 4 2175
轮回少年
轮回少年 2021-02-07 12:44

I have to build project using MSVC2012 and v100 platform toolset (from MSVC2010). Unfortunately I\'m using C++11 feature \"range based for\" across the code. I wonderin

4条回答
  •  萌比男神i
    2021-02-07 13:22

    I don't know if they've fixed it in VS2015, but it certainly works as expected there.

    I created the following small program:

    #include 
    using namespace std;
    
    int main()
    {
        cout << "_MSC_VER: " << _MSC_VER << endl;
        cout << "_MSC_FULL_VER: " << _MSC_FULL_VER << endl;
        cout << "_MSC_BUILD: " << _MSC_BUILD << endl;
    
        (void) getchar();
    
        return 0;
    }
    

    I added build configurations for each platform version from VS2010 to VS2015, and the _MSC_VER corresponded to the PLATFORM version as above - despite always building it in Visual Studio 2015 in a VS2015 project.

    Cheers,

    Ian

提交回复
热议问题