[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
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 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.
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
with fedora, why Hebei, I did not install build-essential package, it reports not found, I know could use eclipse or blockcode but they caught him with gcc compiler should mandatory sir
I have not tried Fedora, but you can use this command:
He asked me how to hit the command line build-essential to the computer, I can not ask password type the appropriate password is
You hit it still enter, but not out there alone.
but you press enter, it sure is wrong password. I also can not use a password to log on to the manager. You workarounds ko
So make sure you have entered the correct password?
If you can not remember the password, I can not know at all.
nhấn alt và enter nhé, nhập mật khẩu vô cũng không được đâu
sure exactly, because when you lock the screen, use this password rebound remains DC. Only the manager and terminal is not in DC
Then we do not know anymore.
People ask themselves when using Eclipse CDT for programming C / C ++ is always error in using namespace std; cout, cin, Endl,… although ultimately it can run programs, People show their solutions. saobanghd94@gmail.com
This one has never seen before, but this failed… not know your breed…
https://www.cachhoc.net/2013/08/27/cc-launch-failed-binary-not-found-eclipse/
do not know if I missing something, ma exam proving geany dung phan compile bi Security?
The thing they do not know, if you send yourself through face Teamview: fb.com/nguyenvanquan7826 yourself for offline viewing.
You yourself asked me to install Ubuntu on a virtual machine to do exercises C but why use the Terminal command line on it were not found error is so, sir? Tks you!!
Not found ah you. Perhaps when you have not installed the update it. Often installed ubuntu you need to update can download the new application and add the new library. You should try it out.
Tks you. I did DC. You ask yourself what it error when compiling Here '? file:///C:/Users/LAN ANH/Downloads/Loi bai3.png
I do not view the image you send.
The little me help you with, sir. I would like to thank.
When running the program Hello.. Launching newspaper and delegate it only 47% (as shown below).
https://www.dropbox.com/s/0nczdva8deab5z4/Untitled.jpg?dl=0
I've found the cause and. Because antivirus software Avast.
Thanks!
Ban Q cho hoi minh muon chay c trong linux, hien thi vay chay ket qua tren web minh can lam the nao ?
Q co the giup minh ?, thanks
VD chay giong vi 3 chapter 6
https://www.wattpad.com/3861046-45-cau-linux-b%C3%A0i-gi%E1%BA%A3ng-c%C3%B4-ti%C3%AAn-full
Mình không hiểu câu hổ của bạn lắm 🙁
mọi người cho mình hỏi, mình viết c thì chạy trên terminal dc mà khi viết sang c++ có dùng thư viên iostream mà khi biên dịch nó kêu tập tinn không tồn tại,không hiểu thư viện hay sao ak
When you write C ++ compiler command mind g ++
his knock “sudo apt-get install gcc” it reported k with apt-get, why here?
You use ubuntu or so which one you use? If ubuntu surely will have, also fedola,… the other commands offline.
DC k unzip his star
What you unzip
Waiter , GCC can build floder is not he , build many files on a tired line
Anh Quân, ơi.. DevC không dùng được trong Ubuntu sao anh..?
I installed CodeBlocks faulty :((
This site does not send you to send photos via fb slightly..
Ubutu, use the ones in the article go.