How to Compile and Run a C Program on Ubuntu Linux
How to Compile and Run a C Program on Ubuntu Linux
Keld Helsgaun Roskilde University, February 2013 This document shows how to compile and run a C program on Ubuntu Linux using the gcc compiler. Step 1. Open up a terminal Search for the terminal application in the Dash tool (located as the topmost item in the Launcher). Open up a terminal by clicking on the icon.
1
For ease of future access to the terminal application, right click its icon in the Launcher and select "Lock to Launcher".
2
Step 2. Use a text editor to create the C source code. Type the command
gedit hello.c
and enter the C source code below:
#include main() {
printf("Hello World\n"); }
Close the editor window.
3
Step 3. Compile the program. Type the command
gcc -o hello hello.c
This command will invoke the GNU C compiler to compile the file hello.c and output (-o) the result to an executable called hello.
4
Step 4. Execute the program. Type the command
./hello
This should result in the output
Hello World
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- open source used in cisco ios release 15 4 1 cg
- open source vs proprietary software pros and cons
- code review guide pre alphav2 owasp
- open source used in cgx 2
- offer of source for open source software
- how to compile and run a c program on ubuntu linux
- best robotics sample program quick start
- the comment density of open source software code
- software legal notices and open source list toolkit app
- open source license disclosure
Related searches
- how to pay cash at a dealership 4
- how to pay cash for a car
- how to write and publish a book
- how to compile multiple pdf
- how to scan and save a document
- run 16 bit program on win 10
- how to copy and paste a hyperlink
- how to copy and paste a url
- how to copy and paste on edge
- how to copy and paste a document
- how to create and patent a product
- how to cut and paste on computer