gcc and g++ are both wrappers around the same underlying compiler engine. They both understand C++ and can compile it. However, the linking step to produce a final executable is different for the C and C++ languages. The gcc wrapper has no knowledge of the C++-specific libraries needed to link a C++ program. Therefore, the link step will fail with some obscure error messages.
Unless you are compiling a truly standalone C++ program that doesn't use any C++ features which are provided by runtime support (i.e., no exceptions, no C++ standard libraries, no nothing, really), you cannot use gcc to link a C++ program.
However, you may be able to compile with gcc and then link with g++, though I have no idea why you'd want to:
Code:
$ XXXXXXXXXX
$ XXXXXXXXXX
I do not recommend the above. In fact, it's so disgusting that I've blanked it out because you'd probably take it and run with it.
I will not use g++ to compile my *.cpp until i know why. Thank you.
This is simply baffling. The default assumption should be to use the right tool for the job. There's being curious, and there's being deliberately obstinate.