Compiling C 11 with g Using Flags
To update your C compiler to C 11, you need to specify appropriate flags. Flags are command-line arguments passed to the compiler that affect the compilation process.
Understanding Flags
When you specify a flag, it instructs the compiler how to interpret and process the source code. Flags can control various aspects of compilation, such as language version, optimization settings, and library inclusion.
Compiling with C 11 Support
To compile your C code with C 11 support, you need to use the following flags:
If you are encountering the error message indicating lack of compiler support for C 11 features, you can resolve it by specifying either of these flags in the compilation command.
Example:
To compile your source file your_file.cpp with C 11 support, use the following command:
$ g++ -std=c++11 your_file.cpp -o your_program
Note:
If -std=c 11 does not work, you can try using -std=c 0x. The latter flag is deprecated but may still be supported in some environments.
The above is the detailed content of How Do I Compile C 11 Code with g Using Compiler Flags?. For more information, please follow other related articles on the PHP Chinese website!