Step 1:: Put the C++ source code in a file with extension .cpp
Step 2:: Let the terminl know where you have saved the code. i.e. specify the path.
Step 3:: Write g++ filename.cpp -o test to compile it.
Step 4:: Now run it by using ./test.
You will see output of your program in terminal window.
During run time, you may have error, because coading of C++ in linux is little bizarre.
Here is the example::
#include<iostream>
main()
{
std::cout<<"testing"<<"\n";
}
Now you surely get the output.
Still getting errors??? Then make sure you have installed necessary package to run C++ program. If not, say terminal to install it by using sudo apt-get install build-essential g++ & connect computer to internet.


This comment has been removed by the author.
ReplyDelete