I want to use std::initializer_list
s in Visual Studio 2012 like a guy in this example does. My operating system is Windows 8 x64.
Therefore I lately installed the Visual C++ Compiler November 2012 CTP and as mentioned by Microsoft, I changed the platform toolset of my project to use that new updated compiler.
But even after doing so, there is neither a std::initializer_list
nor a <initializer_list>
header available. But the linked website from Microsoft tells me (under the headline "Overview") that initializer lists would be available with that update. I restarted both the IDE and my PC. I am not sure if it could be caused by the fact that I am (sadly) using the German edition of Visual Studio and the compiler update is in English. What am I doing wrong?
Update: Trying to compile the line auto a = { 0 };
which is criticized by IntelliSense the compiler output shows 'Microsoft Visual C++ Compiler Nov 2012 CTP' is for testing purposes only.
and then compiler crashes and a error window appears which reads Microsoft (R) C/C++ Compiler Driver has stopped working
. Without any new syntax, everything compiles and works fine with the new compiler selected.
(I work for Microsoft and with Dinkumware to maintain VC's Standard Library implementation.)
[danijar]
I am not sure if it could be caused by the fact that I am (sadly) using the German edition of Visual Studio and the compiler update is in English.
Unfortunately, the English-only CTP does not support German VS.
The "compiler driver" cl.exe is what invokes the compiler front-end c1xx.dll, the compiler back-end c2.dll, and the linker link.exe. It is very unusual for the compiler driver to crash. I speculate that it's attempting to display one of the error messages that were added by the CTP, but since the CTP didn't update the German resources, the compiler driver can't load the error message and proceeds to crash.
Note that this is different from an Internal Compiler Error in the front-end or back-end, or a normal compiler error that happens to be incorrectly emitted. (Many ICEs and bogus errors have been fixed after the CTP was released.)
But even after doing so, there is neither a std::initializer_list nor a <initializer_list> header available.
The CTP installed <initializer_list> in a special location. (It was actually written by the compiler team.)
On the command line, the incantations to use the CTP and put <initializer_list> on the include path are (assuming default locations):
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
set PATH=C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2012 CTP\bin;%PATH%
set INCLUDE=C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2012 CTP\include;%INCLUDE%
Trying to compile the line auto a = { 0 }; which is criticized by IntelliSense
This was documented - Intellisense was not updated by the CTP, therefore it will not recognize any of the new features.
[rubenvb]
The C++ Standard Library was not updated with the compiler, leaving you without decent <tuple> and <intializer_list> (this includes the omission of the braced init list constructors for all standard containers)
You may be interested to learn that we've updated the standard library to fully support scoped enums and initializer lists. This includes all initializer_list overloads mandated by the current Working Paper (N3485), plus installing <initializer_list> in the usual location along with all other standard headers. (It is also Dinkumware's official copy, although the differences between it and the compiler team's "fake" version were mostly cosmetic.) This stuff will be available in the next public release, whenever and whatever that is. Our next task is to update the standard library with explicit conversion operators and variadic templates, replacing our brittle simulations.
As you have noticed, the November CTP is very limited in usability for at least two reasons:
The compiler has numerous crash-causing bugs, such as the one you discovered.
The C++ Standard Library was not updated with the compiler, leaving you without decent <tuple>
and <intializer_list>
(this includes the omission of the braced init list constructors for all standard containers)
Also: the linked example is very ugly code. If you want to use this feature, use a compiler like GCC or Clang that supports this syntax. They are both available for Windows. Hacking around a half-implemented language feature by writing extra code is just stupid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With