What is the difference between GCC and G ++? I searched for it online and then again. There are a lot of strange ideas from around the world. Please read the document directly ..
Quote:" The use Gcc Does not add the C ++ library.
G ++ Is a program that callgcc and treats' . C ',
` . H And' . I 'Files as C ++ source files instead of C source
Files unless -X Is used, and automatically specifies linking
Against the C ++ Library "(BTW: C ++ header files under GCC generally use. HH)
Add the parameter-V (verbose mode) during GCC and G ++ compilation. You can see that they connect to these libraries by default:
G ++:-lstdc ++-lm-lgcc_s-lgcc-LC-lgcc_s-lgcc
GCC:-lgcc-lgcc_eh-LC-lgcc-lgcc_eh
Therefore, the difference between GCC and G ++ lies in the processing of the default filetype. If G ++ is used, pay attention to the extension or add the extern "C "; another important point is that G ++ equals gcc-lstdc ++ during connection.
BTW, about extern "C": If C and C ++ libraries are mixed, or you want to writeCodeAfter compiling different C ++ compilers, the first problem is name mangling. For more information, see explore C ++ to explain extern "C ".