Difference between revisions of "Getting Started With C"

From CsWiki
Jump to: navigation, search
(How to Compile With GCC)
(introduction)
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==introduction==
 
==introduction==
This page describes the necessary surrounding for coding in c programming language and running your code.<br/>
+
This page describes the general surrounding for coding in c programming language, and running your C code.<br/>
 
+
Coding in C language can be done in text editors such as (vim, gedit, nano),terminal in linux or mac, or visual studio in windows.<br/>
 
+
also available are IDE(Integrated Development Environment) programs, such as netbeans,code::blox,clion etc...<br/>
==introduction==
+
Clion IDE is available at the Aquarium computers, it can be found at:<br/>
Coding in C language can be done by different IDE’S. The recommended on is  Clion IDE by jetbrains.<br/>
+
In the Aquarium computers, it can be found at:
+
 
   '''applications Tab → Programming→ Clion.''' <br/>
 
   '''applications Tab → Programming→ Clion.''' <br/>
 +
 
[[File:Clion.png|500px]]
 
[[File:Clion.png|500px]]
 
<br/>
 
<br/>
For windows installation of clion,follow this <span class="plainlinks">[http://wiki.cs.huji.ac.il/wiki/Get_JetBrains_Student_License guide]</span> for getting a student licence from jetbarins to all of jetbrains software.<br/>  
+
===Getting Clion for personal use===
after installing Clion, a compiler is needed, such as cgywin or mingw which are available online at and .
+
Clion is an IDE, which is compatible with linux ,mac osx and windows.<br/>
 +
For external installation of clion,follow this <span class="plainlinks">[http://wiki.cs.huji.ac.il/wiki/Get_JetBrains_Student_License guide.]</span><br/>
 +
and acquire a student licence for  jetbarins products. then download and install Clion from jetbarins site and enter the license.<br/>
 +
after installing Clion, a compiler is needed to be installed, such as gcc, which is included in cgywin or minGW.
  
 
===Compiling in C===
 
===Compiling in C===
Compiling is the process of converting one programing language to another. It is executed by a computer program called a compiler.<br/>
+
Compiling is the process of converting one programming language to another. It is executed by a computer program called a compiler.<br/>
In The school’s computer system, GCC is the default compiler used by courses for compiling needs.<br/>
+
In The school’s computer system, GCC is the default compiler.<br/>
 +
In mac computers, the os comes with an integrated compiler called Clang. to access it open the terminal and write clang.<br/>
 +
In linux computers, it's varies according to the linux distribution used,some come with integrated compiler(ubuntu) and some require<br/>
 +
to download a compatible compiler.<br/>
 +
In Windows it can be done in visual studio, or downloading a compatible compiler from the internet.<br/>
 +
Some IDE's enable to compile and run programs internally.
  
 
===How to Compile With GCC===
 
===How to Compile With GCC===
After finishing writing down the code in C , open the terminal , then select the folder where your file is saved by using :'''cd PATH/'''.<br/>
+
After finishing writing down the code in C , open the terminal , select the location of the .c file with :'''cd FILE_PATH/'''.<br/>
Then use the compiling command:
+
Then use the compiling command in at the terminal window.:
  '''gcc -Wextra -Wall -Wvla -std=c11 file_name.c -o output file name'''.<br/>
+
  '''gcc -Wextra -Wall -Wvla -std=c11 file_name.c -o output_file_name'''.<br/>
if warnings are raised , the file may or may not be compiled. if the file has not compiled, the user will have<br/>
+
if errors are raised ,the file will not be compiled until the problems will be solved.
to handle the causes to the warnings and errors and after that try again until the warnings are gone.<br/>
+
if warnings are raised ,<br/> the file may or may not be compiled, it is preferable to handle the warnings and compile
else,the file will be compiled and an output file with the name you have designated will be created at the same<br/>
+
again. .<br/>
directory as the compiled file.<br/>
+
after file had compiled , an output file with the designated name will be created at the same<br/>
after all the warnings has been solved, in the termimal, select the file and press enter, and the file will <br/>
+
directory as the original file.<br/>
run at the terminal.<br/>
+
to run it, just select the output file in the terminal and press enter.<br/>
 +
compiling exmaple in linux, showing the command in terminal, where test.c is the c file that the user has wrote,<br/>
 +
and result is the output file which was created in the compiling process and can run in the terminal<br/>
 +
[[File:Compiling_example.png|right|500px]]
 +
 
 +
===Comparing Codes===
 +
For comparing two code files or more, the user may use the diff command which can be read about at this <span class="plainlinks">[http://wiki.cs.huji.ac.il/wiki/Diff Link]</span>.

Latest revision as of 14:41, 5 August 2018

introduction

This page describes the general surrounding for coding in c programming language, and running your C code.
Coding in C language can be done in text editors such as (vim, gedit, nano),terminal in linux or mac, or visual studio in windows.
also available are IDE(Integrated Development Environment) programs, such as netbeans,code::blox,clion etc...
Clion IDE is available at the Aquarium computers, it can be found at:

 applications Tab → Programming→ Clion. 

Clion.png

Getting Clion for personal use

Clion is an IDE, which is compatible with linux ,mac osx and windows.
For external installation of clion,follow this guide.
and acquire a student licence for jetbarins products. then download and install Clion from jetbarins site and enter the license.
after installing Clion, a compiler is needed to be installed, such as gcc, which is included in cgywin or minGW.

Compiling in C

Compiling is the process of converting one programming language to another. It is executed by a computer program called a compiler.
In The school’s computer system, GCC is the default compiler.
In mac computers, the os comes with an integrated compiler called Clang. to access it open the terminal and write clang.
In linux computers, it's varies according to the linux distribution used,some come with integrated compiler(ubuntu) and some require
to download a compatible compiler.
In Windows it can be done in visual studio, or downloading a compatible compiler from the internet.
Some IDE's enable to compile and run programs internally.

How to Compile With GCC

After finishing writing down the code in C , open the terminal , select the location of the .c file with :cd FILE_PATH/.
Then use the compiling command in at the terminal window.:

gcc -Wextra -Wall -Wvla -std=c11 file_name.c -o output_file_name.

if errors are raised ,the file will not be compiled until the problems will be solved. if warnings are raised ,
the file may or may not be compiled, it is preferable to handle the warnings and compile again. .
after file had compiled , an output file with the designated name will be created at the same
directory as the original file.
to run it, just select the output file in the terminal and press enter.
compiling exmaple in linux, showing the command in terminal, where test.c is the c file that the user has wrote,
and result is the output file which was created in the compiling process and can run in the terminal

Compiling example.png

Comparing Codes

For comparing two code files or more, the user may use the diff command which can be read about at this Link.