It seems to me that gcc can deal with both c and c++ projects,so why is g++/gcc-c++ needed?
What’s the difference between g++ and gcc-c++?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
gccwill compile C source files as C and C++ source files as C++ if the file has an appropriate extension; however it will not link in the C++ library automatically.g++will automatically include the C++ library; by default it will also compile files with extensions that indicate they are C source as C++, instead of as C.From http://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html#Invoking-G_002b_002b:
For example, to compile a simple C++ program that writes to the
std::coutstream, I can use either (MinGW on Windows):But if I try:
I get undefined references at link time.
And for the other difference, the following C program:
compiles and runs fine using:
But gives several errors when compiled using:
Errors: