enable C++ 11 under GNU

enable C++ 11 under GNU
one liner solution : g++ -D__cplusplus=201103L -std=gnu++11

in GUI
This can be set within Eclipse at

  • Add symbol: Project -> Properties -> C/C++ General -> Path and Symbols -> Tab [Symbols]. Add the symbol : __cplusplus with the value 201103L
  • and

  • Set complier flags: Project -> Properties -> C/C++ Build –> setting –> GCC C++ Compiler –> Miscellaneous –> Other flags . add -std=gnu++11

  • why 201103L?

    Read

    #if __cplusplus < 201103L # include
    #else
    ….

    C++11 support
    #end if