Q:

Building llvm examples

I followed the below from http://llvm.org/docs/GettingStarted.html - which completed successfully:
cd where-you-want-llvm-to-live
get the code
...
make

I put these in my home directory, so my structure looks like
~/llvmHome/llvm/<souce code is here>
~/llvmHome/build/Debug+Asserts/bin/<clang++ executables etc are here>

I'm attempting to follow the steps on http://llvm.org/docs/tutorial/LangImpl3.html to build the example.
I'm performing
cd ~/llvmHom/llvm/examples/Kaleidoscope/Chapter3 //so I'm where I checked out the source code

Then, I'm trying:
~/llvmHome/build/Debug+Asserts/bin/clang++ -g -O3 toy.cpp `~/llvmHome/build/Debug+Asserts/bin/llvm-config --cppflags --ldflags --libs core` -o toy

This gives warnings, and up to the first error
In file included from toy.cpp:1:
In file included from ~/llvmHome/llvm/include/llvm/IR/Verifier.h:24:
In file included from ~/llvmHome/llvm/include/llvm/ADT/StringRef.h:14:
~/llvmHome/llvm/include/llvm/Support/Allocator.h:82:42: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  virtual MemSlab *Allocate(size_t Size) override;
                                         ^
~/llvmHome/llvm/include/llvm/Support/Allocator.h:83:42: warning: 'override' keyword is a C++11 extension [-Wc++11-extensions]
  virtual void Deallocate(MemSlab *Slab) override;
                                         ^
In file included from toy.cpp:2:
In file included from ~/llvmHome/llvm/include/llvm/IR/DerivedTypes.h:21:
In file included from ~/llvmHome/llvm/include/llvm/IR/Type.h:19:
In file included from ~/llvmHome/llvm/include/llvm/ADT/APFloat.h:20:
In file included from ~/llvmHome/llvm/include/llvm/ADT/APInt.h:19:
In file included from ~/llvmHome/llvm/include/llvm/ADT/ArrayRef.h:14:
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:235:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  void push_back(T &&Elt) {
                   ^
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:187:15: error: no member named 'move' in namespace 'std'; did you mean simply 'move'?
      *Dest = ::std::move(*I);
              ^~~~~~~~~~~
              move

Some examaples suggest using g++ to compile, trying that gives
g++ -g -O3 toy.cpp `~/llvmHome/build/Debug+Asserts/bin/llvm-config --cppflags --ldflags --libs core` -o toy
In file included from ~/llvmHome/llvm/include/llvm/ADT/StringRef.h:14:0,
                 from ~/llvmHome/llvm/include/llvm/IR/Verifier.h:24,
                 from toy.cpp:1:
~/llvmHome/llvm/include/llvm/Support/Allocator.h:82:40: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 [enabled by default]
~/llvmHome/llvm/include/llvm/Support/Allocator.h:83:40: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11 [enabled by default]
In file included from ~/llvmHome/llvm/include/llvm/ADT/ArrayRef.h:14:0,
                 from ~/llvmHome/llvm/include/llvm/ADT/APInt.h:19,
                 from ~/llvmHome/llvm/include/llvm/ADT/APFloat.h:20,
                 from ~/llvmHome/llvm/include/llvm/IR/Type.h:19,
                 from ~/llvmHome/llvm/include/llvm/IR/DerivedTypes.h:21,
                 from toy.cpp:2:
~/llvmHome/llvm/include/llvm/ADT/SmallVector.h:235:20: error: expected ‘,’ or ‘...’ before ‘&&’ token

I'm not sure how how to debug this further, any ideas on what I'm getting incorrect?
Should I be linking to libraries under ~/llvmHome/build/ instead of into the source code?

A:

LLVM (and clang) recently switched to C++ 11. So, you need to have reasonable compiler (e.g. clang or gcc 4.7+) and compile everything with -std=c++11 flag.

