Quick Answer: How to Compile C Code in Linux?
Contents This Document Shows How to Compile and Run a C Program on Ubuntu Linux Using the Gcc Compiler. Open up a Terminal. Search for the Terminal Application...
Contents
This document shows how to compile and run a C program on Ubuntu Linux using the gcc compiler.
- Open up a terminal. Search for the terminal application in the Dash tool (located as the topmost item in the Launcher).
- Use a text editor to create the C source code. Type the command.
- Compile the program.
- Execute the program.
How do I code C in Linux?
We will be using the Linux command line tool, the Terminal, in order to compile a simple C program.
To open the Terminal, you can use the Ubuntu Dash or the Ctrl+Alt+T shortcut.
- Step 1: Install the build-essential packages.
- Step 2: Write a simple C program.
- Step 3: Compile the C program with gcc.
- Step 4: Run the program.
How do I run a CPP program in Linux?
Follow these steps to run programs on terminal:
- Open terminal.
- Type command to install gcc or g++ complier:
- Now go to that folder where you will create C/C++ programs.
- Open a file using any editor.
- Add this code in the file:
- Save the file and exit.
- Compile the program using any of the following command: