GCC支持C++11编译

gcc编译的四个阶段
https://blog.csdn.net/weixin_42244181/article/details/107426386

当使用GCC编译时,如果需要使用C++11的标准去编译。就需要在编译时指令中加入-std=c++11, gcc版本要支持C++11

$ g++ -g -Wall -std=c++11 demo_auto.cpp 
$ ls
a.out  demo_auto.cpp

未指定输出文件名默认为a.out

$ g++ -g -Wall -std=c++11 demo_auto.cpp -o demo
$ ls
demo  demo_auto.cpp

-o 指定输出文件名 demo

$ gcc --version  //gcc查询命令

gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cmake --version //camke查询命令

cmake version 3.6.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

more:
https://stackoverflow.com/questions/16886591/how-do-i-enable-c11-in-gcc

你可能感兴趣的:(C++)