What is the difference between g++ and gcc?

后端 未结 10 2159
无人共我
无人共我 2020-11-22 00:34

What is the difference between g++ and gcc? Which one of them should be used for general c++ development?

10条回答
  •  情深已故
    2020-11-22 00:46

    Although the gcc and g++ commands do very similar things, g++ is designed to be the command you'd invoke to compile a C++ program; it's intended to automatically do the right thing.

    Behind the scenes, they're really the same program. As I understand, both decide whether to compile a program as C or as C++ based on the filename extension. Both are capable of linking against the C++ standard library, but only g++ does this by default. So if you have a program written in C++ that doesn't happen to need to link against the standard library, gcc will happen to do the right thing; but then, so would g++. So there's really no reason not to use g++ for general C++ development.

提交回复
热议问题