C-programming - Test c plus plus cpp on linux, How to write a c plus plus program
Test c plus plus cpp on linux
Install C++ / gcc compiler on LINUX# yum install gcc gcc-c++ autoconf automake
To write or execute a C++ program on linux follow the steps given below.
g++ is the compiler the have to be used for executing C++ program.
You must use .cpp file extension rather than a .c one
# vi first.cpp #include <iostream> int main() { std::cout << "Welcome to W3calculator" << std::endl; return 0; }
Compile the c++ program as shown below
# g++ first.cpp -o firstThe above command will create the executable first
# ls -al -rwxrwxr-x 1 info info 6058 Jul 24 22:55 first -rw-rw-r-- 1 info info 100 Jul 24 22:52 first.cpp
Output:
# ./first Welcome to W3calculatorJust run the executable ./first which will give the output.
The topic on C-programming - Test c plus plus cpp on linux is posted by - Math
Hope you have enjoyed, C-programming - Test c plus plus cpp on linuxThanks for your time