How to compile C++ program in Ubuntu
As we know, there are so many texteditor and compiler to create and compile any program. Generally, texteditor and compiler is to be one packet and it makes us easy to work with besiades it is user friendly as well. That all facillity spoiles us even we have to learn as well. But, how if we find new compiler that have difference way to use like g++ in Ubuntu. It gives us a little bit effort to understand it of course even for some people it can make them lazy.
Here I will explain how to compile C++ programs using g++ compiler in Ubuntu. I assume you create the program using nano text editor and you have installed g++. Let's say you name the program as example.cpp and we will do all work from terminal
first, open terminal. You can use hot keys ctrl+alt+T to open terminal.
second, create compiling program
"g++ example.cpp"
third, check location of file in which directory it's been saved.
use "ls" command to show or list any file and directory at certain directory. You will find "a.out" file, that is compile program.
fourth, execute the file a.out
"./a.out"
see berfore a.out, you find "./" command. than, enter to execute program and the terminal will show you the result program.
That's all from me, guys. Hope it helps you...
Here I will explain how to compile C++ programs using g++ compiler in Ubuntu. I assume you create the program using nano text editor and you have installed g++. Let's say you name the program as example.cpp and we will do all work from terminal
first, open terminal. You can use hot keys ctrl+alt+T to open terminal.
second, create compiling program
"g++ example.cpp"
third, check location of file in which directory it's been saved.
use "ls" command to show or list any file and directory at certain directory. You will find "a.out" file, that is compile program.
fourth, execute the file a.out
"./a.out"
see berfore a.out, you find "./" command. than, enter to execute program and the terminal will show you the result program.
That's all from me, guys. Hope it helps you...
Comments
Post a Comment