adsense


Wednesday, 18 November 2015

C++ LANGUAGE COMPILE AND EXECUTE C++PROGRAM PAGE 04

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button



C++ LANGUAGE COMPILE AND EXECUTE C++PROGRAM







Compile & Execute C++ Program: 



Let's look at how to save the file, compile and run the program. 
Please follow the steps given below: 

1. Open a text editor and add the code as above. 

2. Save the file as: hello.cpp 

3. Open a command prompt and go to the directory where you saved 
the file. 

4. Type 'g++ hello.cpp' and press enter to compile your code. 
If there are no errors in your code the command prompt will take 
you to the next line and would generate a.out executable file. 

5. Now, type 'a.out' to run your program. 

6. You will be able to see ' Hello World ' printed on the window. 

$ g++ hello.cpp 

$ ./a.out 

Hello World 

Make sure that g++ is in your path and that you are running it 
in the directory containing file hello.cpp. 
You can compile C/C++ programs using makefile. For more details, 
you can check our ‘Makefile Tutorial’. 


No comments: