g++ compile with c++11 code example Example 1: g++ compile c++11 $ g++ -std=c++11 your_file.cpp -o your_program Example 2: use c++17 g++ g++ -std=c++1z