[Linux – C / C ] Programming C / C on Ubuntu (Linux)

Probably had too many articles to guide you programming in C / C on Ubuntu or Linux in general, but I still see a lot of your questions on the facebook group and direct message again, something like that “I learn new (work, installation) Ubuntu, C programmers now want this on how?” and so on and so forth similar questions.

[qads]

Content
Install the package library
Using gedit and terminal
Use Geany
Using the Code::Block
Using eclipse

Do not understand is that you do not have to search giants Google or posts that are still too difficult for you to find out more. Both 2 why are not there yet though is why the hell is it going again following article will guide you in detail about the settings and get familiar with the C programming on Linux under “the type of momentum that” for your new user

Install the package library

First, the terminal you open up (Ctrl + Shift + T) run the following command to install the package libraries needed for programming C / C (Please enter a password)

sudo apt-get install build-essential

Noted: In the C library on Linux without conio.h library and other libraries in the window. You can search on google the corresponding library.

After this command is done we can make the programming and.

Using gedit and terminal

All programs and C can always be compiled and run in terminal. How to run first, then create a C program. You create 1 helloLinux.c by file name Right click on the Desktop -> new document -> empty document open it (gedit is open by default on Ubuntu) and write programs with similar content:

#include <stdio.h>

int main(){
	printf("Chao mung ban den voi C trong Ubuntun");
}

And then we open up a terminal, execute the move to Desktop (cd Desktop). Then execute the command to compile our program.

gcc helloLinux.c -o helloLinux

If the compilation is successful, it does not press anything on the desktop and you appear more as a lozenge file hello linux, if there are errors or warnings (wraing letters warning that something, error is error).

gcc is our token gcc capacity to translate. to care for gcc C (file *.c), You can use g instead of gcc (g to C translation (file *.cpp)).
helloLinux.c is our code file
-o helloLinux make informed run the output file name is helloLinux. Can you name the other (VD -o -o hello or nguyenvanquan7826, …). Without this parameter ie we only run the command gcc helloLinux.c by default it will be for us to run the file is a.out

That's just the only compiler@@still running again. To run the commands you to perform:

./helloLinux

On the terminal screen appear the words Welcome to Elephant C in Ubuntu
C programming in ubuntu
That's it then bee =)). All our programs can be compiled on a special terminal and several (Graphics,…) need to run on the new terminal.

Use Geany

The implementation compile and run the program on the terminal with the command seems a bit long and time consuming, it must. Now we will learn a tool to support the C programming is Geany. It's like the dev-C on Windows so.

* Install Geany
The installation Geany you can easily implement in Ubuntu sofware center, symbol is boiling teapot =))

Programming C by Geany on ubuntu

Or you can install directly by typing in the terminal:

sudo apt-get install geany

* Use Geany C programming
Once installed, launch and open or code 1 programs have interfaces like this

use Geany C programming in ubuntu

The function of the interface as well as the steps described in the above image. Generally everything is very simple =)). But there is a drawback of the debug Geany (find and fix) This little hard on and I never try@@.

Using the Code::Block

Installation Code::Block similar Geany. On the Ubuntu software center you find the keywords codeblock, was installed in the terminal, run the following command:

sudo apt-get install codeblocks

After installation you boot up it will display a dialog to select the compiler to compile. By default, it uses gcc, you just press the OK is finished.

use code::Block C programming on ubuntu

Boot up we will start page of the interface code::Block (just install your copy here 13.12 on Ubuntu)

use code::Block C programming on ubuntu

At this point, then you can perform on a windows like normal but you still do.

Using Eclipse

* Install eclipse
The use eclipse to code C / C is a very good solution because it supports such things as easily debug, align beautifully code, avoid a lot of error code for the error even if you do it wrong code syntax or something there is a risk of error,…

If you want to install an eclipse can be programmed more (as java, android) then see how install eclipse here or installed then good too ^^. But if you just want to install eclipse to programming in C / C , please stop here and download eclipse for C / C

C programming eclipse in Ubuntu

If you use eclipse for C / C , simply unzip the downloaded and is finished. If you use eclipse in the standard way 1 must install Eclipse CDT (C/C development tools) to programming in C / C as follows:

On the menu Help -> Install New Software
install new software in eclipse

The following window opens, select Add and select one of the following links corresponding to the eclipse you are using (here is my eclipse Kepler, to know what you use eclipse to Help -> About)
Eclipse 4.3 (Kepler): http://download.eclipse.org/releases/kepler
Eclipse 4.2 (Juno): http://download.eclipse.org/releases/juno
Eclipse 3.7 (Indigo): http://download.eclipse.org/releases/indigo
Eclipse 3.6 (Helios): http://download.eclipse.org/releases/helios
Eclipse 3.5 (Galileo): http://download.eclipse.org/releases/galileo

add CDT fo eclipse

Wait a minute it load the plugin, look at the table below to find and select the Programming Language C / C Development Tools then “Next” -> … -> “Finish”

C/C++ development tools fo eclipse

* Create a project and run the program first
Open up to eclipse File -> New Project -> C/C Project C or C and select the project you want to create.
create C/C++ project in eclipse

Enter your name and the next project. Choose blank or hello world project and finish

It is finished project and the code hello world.
Want to run your service before the program by going to the menu Project -> Build Project hoặc Build All Then press the Run button to run without error will Launch Failed: Binary not found

run c in eclipse

After reading this article make you sick and tired of the house. Mềnh writing is still more tired =)). But trying to read the article later ^^
Graphics C on Linux
Rats in C on Linux