C++ : Compile and Execute Flashcards
To compile a file in c++, you’ll need to type
g++ followed by the file name then press enter
To execute the new machine code file
all you need to do is type ./ and the machine code file name in the terminal and press enter
For giving the specific name of the file
there should be -o and then the name that you want to give
g++ hello.cpp -o hello
What you read and write is called
source code
what the computer executes is called
executable, object code, or machine code (a machine language).
A compiler translates the C++ program into
machine language code which it stores on the disk as a file with the extension .o (e.g. hello.o).
A linker then links the object code
with standard library routines that the program may use and creates an executable image which is also saved on disk, usually as a file with the file name without any extension (e.g. hello). (optional, understanding is no1 priority)
The executable is loaded from the disk
to memory and the computer’s CPU (Central Processing Unit) executes the program one instruction at a time.