C++ compiler
- how to run cpp program in terminal
- how to run cpp program in terminal ubuntu
- how to run c++ program in terminal ubuntu
- how to run cpp code in terminal ubuntu
How to run c++ program in windows 10!
How to run c++ code in terminal vscode
How to Compile a C++ Program Using GCC
In C++, the GNU Compiler Collection (GCC) is one of the most popular C/C++ compiler that is used to compile and execute the C and C++ program. In this article, we will learn how to compile a C++ program using GCC.
Compiling a C++ Program Using GCC
The GNU Compiler Collection (GCC) is a versatile tool that can compile C++ programs.
To compile a C++ program using GCC, we can follow the below steps :
Step 1: Open the terminal/CMD and navigate to the source code directory.
Use the cd command in the terminal/CMD to navigate to the directory where your C++ program file is located:
cd /path/to/your/directoryStep 2: Compile the C++ Program
To compiler the C++ program use the following command:
g++ -o output_file_name source_file.cppwhere:
- -o output_file_name: defines the name of the output executable file.
- source_file.cpp: is the name of your C++ program file.
Step 3: Run the Compiled Program
Finally, you can run the compiled program from the terminal using the below command:
./output_file_name /// for linuxoutput_file_nam- how to execute cpp program in terminal
- how to run cpp code in terminal mac