I have been following Bjarne Stroustrup's Book's C++ Programming and Principles 2nd Edition.
My problem is, in his book Bjarne uses some functions from the C++11 standard, which using the following code I discovered I was using c++98.
if (__cplusplus == 201103L) std::cout << "C++11\n";
else if (__cplusplus == 199711L) std::cout << "C++98\n";
else std::cout << "pre-standard C++\n";
When I discovered this, I was using VS 2013 ultimate on a machine with Win8.1 with platform toolset set to v12.0 or higher. I have VS 2010 and VS 2015 (just installed 2015 to see if it fixed the issue) installed on my machine as well.
None of this worked. Beyond the platform toolset being set to v12.0, I have not found any other solutions online. My friend that runs VS 2013 and 2015 on his Mac through parallels does not have this issue.
This thread has the same issue though the OP was using VS 2010: How to "activate" c++11 standard in visual studio 2010?
This thread demostrates that it may be a microsoft issue but still, no solution: https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l
I am completely lost at this point and have no idea how to fix it. Without this standard it makes following Bjarne's book nearly impossible.
How do I change or update my C++ standard?!?!
EDIT / SOLUTION: So the main reason I made this post was while following the book above, I ran into an issue where using initializer-lists were not a recognized feature. According to other posts on this question and links provided, initializer-lists are clearly a feature of C++11 so after I used the above code I assumed I was not using C++11.
Below, are the steps I took to resolve this issue.
- First I uninstalled all 2010 redistributables including VS 2010 itself.
- Through Programs and Features, I ran VS 2013 uninstall wizard and selected 'repair'
- This resolved the issue I was getting about 'initializer-lists' not be recognized, however, there was another error that popped up that the book did not cover.
The error and solution I was getting ended up resulting from an out of date std_lib_facilities.h despite the fact I copied the link straight from the book .PDF
The error and solution I was getting can be found here: Simple Code Need Help - no instance of constructor matches argument list
PS: I have not reinstalled 2010 redistributables since I don't for see me having a need for them at the moment.