Factsheet
Videos
I am pretty sure it is a standalone compiler that can make exeβs and stuff. However, I just donβt get what is so special about it, and why it seems like almost everyone uses it. I use visual studio, and I enjoy doing game development with unreal, and making algorithm visualizers and stuff with simple libraries like sfml, and since itβs an ide I just assumed I just never have to touch G++.
Edit: also itβs probably good to mention I am going into my 5th semester of my cs bachelors. So idk if thats good or not to not really of known exactly what it was, but thanks to everyone for all the feedback.
This is typical Ubuntu symlink mayhem.
If you ls -l /usr/bin/c++, you will see it is actually a symbolic link. to:
/etc/alternatives/c++
Which in turn, is also a symbolic link to:
/usr/bin/g++
So, on Ubuntu systems, c++ is g++. The reasoning behind the link indirection is that there are multiple packages that could provide a c++ compiler (such as different versions of g++). You'll see this a lot on Ubuntu. For example, qmake is a link to a file in /etc/alternatives, which is (on my system) a link back to /usr/bin/qmake-qt3.
c++ is a standard name of a C++ compiler on a system.
On a GNU system you almost surely have GCC (GNU compiler collection) installed, which includes a C++ compiler named g++ ('g' for GNU). But to be POSIX-compatible, they install this compiler as c++ also, sometimes c++ is a symbolic link to g++ sometimes it's a hard link, sometimes it's just the same file installed twice.
This can be not the case for other systems like FreeBSD or NetBSD. It's possible that those systems don't have GCC (and other GNU stuff) installed.
On my system these two files are just identical:
% diff `which c++` `which g++`
% echo $?
0
This means that c++ at least invokes the same compiler, but theoretically it can interpret some command line options differently or have some different defaults. Someone with more knowledge is free to extend the answer in this regard.
I really tried it in VS code and clion and VS, but it doesn't work out, is there a way to compile with gcc compiler in windows without the need of Linux servers?
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 roughly 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).
By default (and unlike gcc), g++ also adds linker option -lm -- to link against libm which contains implementations for math.h.
GCC: GNU Compiler Collection
- Referrers to all the different languages that are supported by the GNU compiler.
gcc: GNU C Compiler
g++: GNU C++ Compiler
The main differences:
gccwill compile:*.c\*.cppfiles as C and C++ respectively.g++will compile:*.c\*.cppfiles but they will all be treated as C++ files.- Also if you use
g++to link the object files it automatically links in the std C++ libraries (gccdoes not do this). gcccompiling C files has fewer predefined macros.gcccompiling*.cppandg++compiling*.c\*.cppfiles has a few extra macros.
Extra Macros when compiling *.cpp files:
#define __GXX_WEAK__ 1
#define __cplusplus 1
#define __DEPRECATED 1
#define __GNUG__ 4
#define __EXCEPTIONS 1
#define __private_extern__ extern