Which program do I need to use for programming in C in ubuntu?

Which program do I need to use for programming in C in ubuntu?

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.

答案1

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

答案2

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.

答案3

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.

相关内容