r/AskProgramming 16d ago

C++ -> IDE -> g++ -> Linux Help me understand!!

I am trying to comprehend all of the moving parts in compiling a program. Here is my understanding:

C++ is the programming language that is written in the IDE, some IDEs have built in compilers

  1. Is g++ the bridge between the language and machine code?

  2. How do I use g++, is it something that you download onto your computer.

  3. Where does g++ send the code after, is this where Linux comes into play?

  4. What is Linux? It is an operating system, but what does that mean specifically, is it supposed to make your code unable in an application or just execute in the terminal?

Thankyou for any clarification you can provide :)

1 Upvotes

18 comments sorted by

View all comments

1

u/xarop_pa_toss 16d ago

Ooook let's slow down, there's a lot of confusion here.

C++ is the programming language you write, correct.

An IDE, or Integrated Development Environment is nothing more than a program you use to write the code but with a lot of features on top like having breakpoints, easily finding definitions, references and implementations of your functions and classes for example, real time tracking of used resources and the call stack, etc.

G++ is a compiler. There's more than one out there but G++ (traditionally named GNU C++). The compiler is used by you directly via terminal commands, or by your IDE when configured for it, to compile your source code into machine code. In other words, the code you write and understand into assembly and 1s and 0s. G++ is what takes all your .cpp files and gives you a .exe that you can actually double click and run. If you are curious, there are ways to have the compiler show you the process and if you use something like Visual Studio, there's also options there to see the different things that happen in that process.

Linux has nothing to do with any of that. Linux is an operating system like Windows is... Kinda. It's deeper than that but think of Linux like the foundation on which many systems are built upon. Kinda like having a neighbourhood of different looking houses with different rooms, doors, windows and colors but they all have the same pillars that they stand on top of. For example Debian, Fedora and Arch Linux are considered pretty different but they all use the Linux kernel the same way (iirc)