Sunday, May 19, 2013

Getting Started with C++11

While I was at C++ Now this past week I was wanting to play with some of the new C++11 features.  The computer that I had was running Windows 7 and Visual Studio Ultimate 2012.  While Visual Studio 2012 is a great editor for C++ with excellent syntax highlighting and auto-complete, it is lacking in support for a lot of C++11 features.  Among the features that I miss are uniform initialization syntax and initializer_list, and variadic templates.  Yes, I know that these are in the November CTP for Visual C++, but that doesn't help me today.

The compilers that most people have easy access to are GCC, Clang, and Visual C++.  Given that Visual C++ does not support the language features that I wanted to play with, that was one compiler down.  GCC has excellent C++11 support and will have support for the complete standard in version 4.8.1.  Clang will have complete C++11 support in version 3.3.

I decided to compile Clang (trunk) using Visual C++ so that I had a compiler that had the features that I wanted to work with.  Clang has excellent instructions on how to build it using Visual Studio.  I followed the instructions with only a minor hitch.  The list of prerequisites includes Python.  I installed Python 3.3.2.  I had a handful of configuration errors that were resolved by uninstalling Python 3.3.2 and installing Python 2.7.5.

Over all, it was rather easy to build Clang.  The instructions were excellent, but a single missing detail (Python version) caused me some headaches.

No comments:

Post a Comment