Compiling C with GCC and the Difference Between GCC and G
While GCC is known for compiling C programs, it can also compile C code. The errors encountered when attempting to compile info.c using "gcc info.C" are not compiler errors but linker errors.
To resolve the linking issue, it is necessary to add the "-lstdc " flag to the compilation command:
gcc info.C -lstdc++
This tells the linker to link the program against the standard C library.
However, for simplicity, it is recommended to use g for compiling C programs.
Difference Between GCC and G
As explained by Rup in a comment on another answer:
The above is the detailed content of GCC vs. G : Why Use G for C Compilation?. For more information, please follow other related articles on the PHP Chinese website!