Compiling C 11 with g : Understanding Flags
To compile C 11 with g , it is necessary to use flags that enable C 0x support. However, the choice between -std=c 0x and -std=gnu 0x depends on your specific needs.
Flags and their Purpose
Flags, also known as compiler options, are arguments that modify the behavior of the compiler. In this case, the flags -std=c 0x and -std=gnu 0x enable support for C 0x, which is an experimental version of the C 11 standard.
Command Line Invocation
Assuming you are using g from the command line, the correct syntax to compile a C 11 file is:
$ g++ -std=c++11 your_file.cpp -o your_program
Possible Alternatives
If the above command does not resolve the issue, you can try using -std=c 0x instead:
$ g++ -std=c++0x your_file.cpp -o your_program
Remember that the choice between -std=c 0x and -std=gnu 0x depends on the specific context and platform you are working with.
The above is the detailed content of How to Compile C 11 Code with g Using the Correct Flags?. For more information, please follow other related articles on the PHP Chinese website!