Avatar ·

What is the difference between g++ and gcc when compiling C++ code?

Hello everyone! I'm a beginner C++ developer trying to understand compilers. I have MinGW installed on Windows, and I noticed that two commands are available in the command line: gcc and g++. I tried compiling a simple C++ program:\n\n```cpp\n#include \nusing namespace std;\n\nint main() {\n cout << "Hello, World!" << endl;\n return 0;\n}\n```\n\nWhen I compile this with the command `gcc test.cpp -o test`, I get linker errors — undefined reference to `std::cout` and others. But if I use `g++ test.cpp -o test`, everything works perfectly. Online sources say that gcc is for C, and g++ is for C++. But shouldn't gcc support C++? After all, the name stands for "GNU Compiler Collection", not "GNU C Compiler".\n\nPlease explain what the fundamental difference is? By