Compile and Execute
For using VSCode in windowns when compiling c++ codes, you need to install a c++ compiler.
C++ is a compiled language. That means that to get a C++ program to run, you must first translate it from a human-readable form to something a machine can “understand.” That translation is done by a program called a compiler.
When you program in C++, you mainly go through 4 phases during development:
Code — writing the program
Save — saving the program
Compile — compiling via the terminal
Execute — executing via the terminal
To compile and execute a C++ code, we should use Terminal. To compile a file, you need to type g++ followed by the file name in the terminal. To execute the new machine code file, all you need to do is type ./ and the machine code file name in the terminal.
To set a different name for the output file, use the following command in the terminal:
Last updated