Someone said I need to add -std=c++0x, -std=c++11 or -std=c++1y.
this is correct. -std means use the version of c++'s standard that comes after the ='s sign. the default for gcc c++ is 2003 iirc, which is pre c++0x, and c++0x is when inline member initializers became legal (before you had to do it in a constructor). c++0x is the name given to the experimental version of c++11, and really doesnt need to be used anymore. c++11 is the release of the c++ standard that caused many major changes and is probably the one you want. c++11 completely changed the language. c++1y is c++14, which isnt as major a change as c++11. now that i think about it, 1y might be the experimental version of c++14.
It works fine for me, Im guessing you use Eclipse? Im using Visual studios 2013.
those are ide's and have nothing to do with the issue at hand.