0

Which program do I need to use for coding in ubuntu? I am 13 and I read in class 6. I need an answer of my standard. I need both the name of it and the link to the website from where I can download it.

3 Answers3

2

you need to have a gcc compiler installed on your box which even comes installed by default as its used to build the OS. To install the latest version of gcc, check the following link: how to install gcc

To compile, simply open terminal (Ctrl+Alt+T) and navigate to the directory where your file is located.

For Example i have this file here:

 #include<stdio.h>
 int main(){
   int age;
   printf("How old are you?");
   scanf("%d", &age);
   printf("Your age is %d ", age);
   return 0;
 }

save this as say ager.c under the Desktop and open Terminal and compile this program like this

 cd ~/Desktop
 gcc -o ager ager.c

Produces an object (executable) file called ager as depicked from the -o prefix Now run the executable like this

 ./ager

Should print something like this

  How old are you?
  23
  Your age is 23

To check which gcc version you have in your system, use the following command in your terminal:

gcc --version

Sorry but am answering from the stack exchange mobile app

Zuko
  • 1,267
  • 11
  • 12
  • I believe the compiler line should be "gcc -o ager ager.c" – Scooter Mar 11 '15 at 06:51
  • IMHO this is the best way to learn C programmming, hence upvoted. I took C programming and used Windows Visual Studio, and was miserable thought the course. Second time around, I was writing everything with nano and compiling gcc - learned so much more just from that, and plus man pages. – Sergiy Kolodyazhnyy Mar 11 '15 at 07:12
  • Apologies @Scooter, typo, im using the stackexchange mobile app.. – Zuko Mar 11 '15 at 07:26
0

Since you are presumably using Ubuntu, you don't need to go to a website to download either a C compiler, or an IDE or source code editor. The C compiler (gcc) comes standard and you can install an IDE or text editor via Ubuntu Software Center. Ubuntu Software Center has a section for Developer Tools which has a subsection IDEs. You can also search for software in the search box. I would recommend starting with Geany for an IDE, or Kate or jEdit if using a source code editor and compiling at the command line.

Scooter
  • 702
0

In order to write and to compile any C program, what is required (regardless of the platform, so Ubuntu is included) is just a text editor to write the code and a C compiler to compile the source file(s). A standard Ubuntu installation comes by default bundled with both multiple programs to edit text files (for example a GUI-based one is gedit) and with GCC (GNU Compiler Collection). So in order to write and to compile any C program, you won't need to install any additional software.

That being said, installing an IDE is suggested, expecially for use with more complicated projects. Personally I use Eclipse CDT.

kos
  • 35,891