3

Is there any difference between g++ and gcc -lstdc++?

That is, is g++ just gcc with the C++ standard library linked by default?

George
  • 6,927
  • 4
  • 34
  • 67
  • 3
    Possible duplicate of [What's the difference between gcc and g++/gcc-c++?](http://stackoverflow.com/questions/5853664/whats-the-difference-between-gcc-and-g-gcc-c) – perryprog Dec 25 '16 at 15:28

1 Answers1

3

g++ is a compiler, like gcc. g++ however includes the ability to parse modern C++ constructs, whereas gcc can do some of these, but is not intended for it.

-lstdc++ and gcc allows the compilation of libraries that use c++ specific runtime interfaces with your C code (gcc).

An example of this is a C application that needs to use a C++ library without needing to completely remake the C application into a C++ one to interface with it.

Dharman
  • 30,962
  • 25
  • 85
  • 135