gcc
and g++
are compiler-drivers of the GNU Compiler Collection (which was once upon a time just the GNU C Compiler).
Even though they automatically determine which backends (cc1
cc1plus
…) to call depending on the file-type, unless overridden with -x language
, they have some differences.
The probably most important difference in their defaults is which libraries they link against automatically.
According to GCC’s online documentation link options and how g++ is invoked, g++
is equivalent to gcc -xc++ -lstdc++ -shared-libgcc
(the 1st is a compiler option, the 2nd two are linker options). This can be checked by running both with the -v
option (it displays the backend toolchain commands being run).
Related Posts:
- Undefined reference to vtable
- Undefined reference to vtable
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- Compiling a C++ program with gcc
- gcc/g++: “No such file or directory”
- error: use of deleted function
- Update GCC on OSX
- Fatal error: iostream: No such file or directory in compiling C program using GCC
- g++ ld: symbol(s) not found for architecture x86_64
- C++ undefined reference to defined function
- Convert char to int in C and C++
- How does #include
work in C++? - Expected initializer before function name
- Inheriting constructors
- make: g++: Command not found
- C ++ error: a expected initializer before [function name]
- Inheriting constructors
- Compiling C++11 with g++
- “g++” is not recognized as an internal or external command, MinGW
- undefined reference to ‘std::cout’
- Eclipse C++ : “Program “g++” not found in PATH”
- MinGW: “gcc is not recognized as an internal or external command”
- “g++” is not recognized as an internal or external command, MinGW
- Visual C++ find line causing “Debug Assertion failed”
- Undefined reference to class constructor, including .cpp file fixes
- Undefined reference to constructor
- CMake error at CMakeLists.txt:30 (project): No CMAKE_C_COMPILER could be found
- expected unqualified-id before string constant
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- cannot declare variable ‘’ to be of abstract type ‘’
- extra qualification error in C++
- C++ Error ‘nullptr was not declared in this scope’ in Eclipse IDE
- Debug vs Release in CMake
- Debug vs Release in CMake
- What does the fpermissive flag do?
- Error: free(): invalid next size (fast):
- gcc: undefined reference to
- Error: free(): invalid next size (fast):
- I get this error: “glibc detected”
- G++ undefined reference to class::function
- Undefined reference to class constructor, including .cpp file fixes
- GCC -fPIC option
- gcc -g :what will happen
- Difference between
and - Warning : overflow in implicit constant conversion
- Getting a bunch of crosses initialization error
- Expected unqualified-id before ‘[‘ token
- cc1.exe System Error – libwinpthread-1.dll missing – But it isn’t
- How to Check the Version of my gcc?
- What does “-Wall” in “g++ -Wall test.cpp -o test” do?
- Make / gcc cryptic error 2: how to have more information?
- Compiling C++11 with g++
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- What is a .h.gch file?
- Update g++ but still old version
- Link error “undefined reference to `__gxx_personality_v0′” and g++ [duplicate]
- How many spaces for tab character(\t)?
- How do I build a graphical user interface in C++? [closed]
- Very basic C++ program issue – Invalid operands to binary expression
- Passing an array by reference
- Why use conio.h?
- Why is enum class preferred over plain enum?
- How to fix C++ error: expected unqualified-id
- How to track down a “double free or corruption” error
- Error: “expression must have integral or unscoped enum type” [duplicate]
- How to fix C++ error: expected unqualified-id
- Is there a decent wait function in C++?
- streambuf::xsgetn and state flags
- C++ table alignment – cout and iomanip
- Debug assertion failed. C++ vector subscript out of range
- Vector is not a Template?
- Is the practice of returning a C++ reference variable evil?
- Is there ‘byte’ data type in C++?
- How to return a string from a C++ function?
- C++, random number w/ range of 1-6
- Copy a file in a sane, safe and efficient way
- expression did not evaluate to a constant- c++
- Generate SHA256 in c++
- A good and basic implementation of BigInt class in C++
- What is the C equivalent to the C++ cin statement?
- c++ Read from .csv file
- C++ Big Integer
- How do I create a random alpha-numeric string in C++?
- Learning to work with audio in C++
- Creating an instance of class
- System not declared in scope?
- no debugging symbols found when using gdb
- C++ Array of pointers: delete or delete []?
- ERROR: Control may reach end of non-void function /
- Function stoi not declared
- What’s the difference between while(cin) and while(cin >> num)
- Too many arguments to function
- not declared in this scope’ when using strlen()
- Converting a Cubemap into Equirectangular Panorama
- error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
- Displaying contents of a vector container in C++
- Converting string to unsigned int returns the wrong result
- Visual c++ can’t open include file ‘iostream’
- c++ vector bubble sort
- compare and swap vs test and set