gcc and g++

in Genius Bar edited January 2014
Whats the difference when I invoke gcc and then g++. When I compile C++ code with gcc somtimes I get errors, somtimes I don't, even if the code is correct. When I do the same thing, but with g++, everything is fine. I really want to know why i have to go through the trouble (i know i know) of typing g++ when i can type gcc. g++ even comes up with the same man page as gcc.


  • Reply 1 of 1
    Gcc and g++ are the same program. (One is a symbolic link to the other.) Gcc/g++ is a C/C++/Fortran/Ada/Java/etc compiler. When you invoke the compiler with "g++", you are explicitly telling it to compile C++ code. When you invoke the compiler with "gcc", gcc will guess the language by looking at the file suffix (.cc for C++ and .c for C). There are also switches to set the language explicitly. Read the man page for more details.

    EDIT: grammar

    [ 09-16-2002: Message edited by: Brian J. ]</p>
Sign In or Register to comment.