[Linux – C / C ] Programming C / C On Ubuntu (Linux)
Có thể bạn quan tâm
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-essentialNoted: 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 helloLinuxIf 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:
./helloLinuxOn the terminal screen appear the words Welcome to Elephant C 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 =))
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
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 codeblocksAfter 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.
Boot up we will start page of the interface code::Block (just install your copy here 13.12 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
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
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
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”
* 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.
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
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
You might like:
Từ khóa » Câu Lệnh Gcc Trong Linux
-
Khởi Tạo Môi Trường Lập Trình C Trên Linux Với GCC
-
[PDF] Bài 2: LẬP TRÌNH C TRÊN LINUX
-
Cách Viết, Biên Dịch Và Chạy Chương Trình C Trong Ubuntu Và Các ...
-
Thử Thực Hiện 4 Stage Khi Compile C Bằng GCC - TopDev
-
Hướng Dẫn Lập Trình C Trên Linux - DevPro
-
Hướng Dẫn Cài đặt GCC Trên Ubuntu 20.04 - N Support
-
Cách để Biên Dịch Chương Trình C Bằng GNU (GCC) - WikiHow
-
Cách Cài đặt Trình Biên Dịch Gcc Trên Ubuntu 18.04 - Joe Comp
-
Cách Sử Dụng Trình Biên Dịch G++ Trên Linux - Make Internet Easier
-
Lập Trình C Trên Linux The Hard Way - Chin
-
Cách Cài đặt GCC Trên Ubuntu
-
Trình Biên Dịch Gcc - 123doc
-
Cách Download, Cài đặt Trình Biên Dịch GCC Trên Ubuntu