After reading this you will learn about
1-gcc compiler
2-how to compile code
3-how to execute c/c++ output file via terminal window(console)
.
This blog is about How to set up c/c++ compiler to work in a easy way with a bash script.
How you set up to compile C++ programs depends on whether you are using Windows or Linux/Unix. This page describes the approach to use if you have a
Linux/Unix machine. On both system , to compile a c/c++ code you need compiler , In
GNU systems c/c++ compiler is called
gcc . For more details how gcc works see manuals lot of documentations are available on web , or just type in terminal
man gcc .(if you have gcc installed)
so you will need to install
gcc to go for code compilation. in terminal type install command
sudo apt-get install gcc now let it finish . assuming gcc installed correctly ,follow steps below -
- and in terminal type ./gcc name of c/c++ code file & Hit enter key .
- compilation done a output file will appear on C++ directory
- To execute that file type ./name of out file with extension.
(note - we can do the same (compilation) with gcc commands. this blog was written for easement of things for peoples who felling hard to learn commands and do mistakes while writing them in terminal.)