[EMAIL PROTECTED] wrote: > Hello, everyone, > > The difference between gcc and g++ puzzles me. Here "gcc" referes to > the > "gcc" command , not the GNU Compiler Collection. > > According to my study, "gcc" invoks cc1plus under /usr/libexec/gcc/ , > and "g++" invokes cc1plus under /usr/libexec/gcc/.
> As C is a subset of C++, You're wrong here. It is not. > why we cannot use g++ alone to compile all C/C++ programs. Because there is no such thing as "C/C++". For the compiler, it's pretty much irrelevant, as long as it has some way of knowing which language you compile. gcc will try to gather that information from the file name, while g++ will always try to compile the code as C++. Another way is to explicitly specify the language to be compiled. But linking is another story. When linking the result generated from C++ code, you need different linker options than for C code, and the linker can't find out the language that the object code was compiled from, so you have to tell it explicitly. When you use gcc for linking, it will pass the options relevant for C code to the linker (unless you explicitly specify the language), while g++ will link it as C++ code. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus