That should be done to create a program with C language in Linux include:
1. Create a script using a text editor program, can use gedit, kate, vi, nano, and so forth. example:
# include <stdio.h>or
void main ()
{
print ("my C program on linux");
}
# include <stdio.h>2. Save the above script with the extension. "C", eg: "test.c"
void main ()
{Print ("my C program on linux");}
3. Now go into the compilation. Log into the terminal, can use tombon "Ctrl + Alt + t" or by clicking Applications> Accessories> Terminal.
4. From the terminal, we go into the file storage directory in the script that created earlier, eg I save in the Document, then I go into the document with the command:
ananurdiana@ubuntu:~ cd Documentthen typing the command C compiler, which is gcc (in the format "gcc-o nama_file_script nama_file_program"). For example:
ananurdiana@ubuntu:\Documents\ gcc test.c -o test5. So when in the list, will appear a new file that can be executed or run.
ananurdiana@ubuntu:\Documents\ lsto run a program that was compiled, with command:
ananurdiana@ubuntu:\Documents\ test.c test
ananurdiana@ubuntu:\Documents\ .test6. Then look at the programs that created earlier as below:
ananurdiana@ubuntu:\Documents\ My C program in linuxThus making the C program in linux, it is very easy is not it!
No comments:
Post a Comment