C programming compiler and installation::
In this chapter we will learn about the compiler and learn how to set the compiler for C.Compiler
Compiler is a computer program or program set that translates a programming language into another programming language. In most cases the compiler is used to convert a program's source code into machinecodes.
Since this tutorial is about C programming issues, we also need to use a compiler which will convert the source code of our C in the machine code.
Run your own operating system
To run C programming, you will see a large number of compilers and text editors. These text editors and compilers may differ from one system to another.
This section shows how to run C programs on your own computer (Windows, Mac OSX and Linux) in a simple way.
Run the C program online
There are many sites to run online C programming. But I recommend you at ideone.com.
To run C Programming at Ideone.com, select the C language from below the editor, enter the C code and click on the run button.
It should also be said that online C compiler has some limitations. For example, you can not work with files, input from the user will not be natural etc.
Run C Programming on Mac OS X
Go to the apple developer site's download page

Download X Code from Apple developer site
Click on the Xcode link. We recommend that you download the latest version of Xcode. It is also a beta version.
After downloading, open Xcode and follow the installation instructions. If you want to use Xcode later, you can put it in Applications.
Then open Xcode and go to File> New> Project.

Navigate to project
Under OS X, select the application and open Command Line Tool

Command line tool under OSX application
Enter Product Name: For example: Select Hello from the Hello section and click on the next button.
Fix the location of your Mac where you want to save the project. If you do not want to create a Git repository, click on the Create Git repository button and uncheck it, click the create button.
Navigate to the main.c file, where XCode will see the default code of C allah.
main.c file in xcode

Change the code you want. And finally to run the code, go to Product> Run or give Cmd + R Commm.
You will see results by default at the bottom of your screen.
Run C programming in Linux
To run C programming in Linux, you will need the following:
A compiler Install the GNU GCC compiler. Because it's a lot easier for beginners
Development tools and libraries
A text editor
The process of running a program on Linux (Ubuntu, Debian, CentOS, Fedora, Red Hat and Scientific Linux) is shown in step by step:
Open the terminal and give the following commands
For Ubuntu and Debian Distribution:
$ sudo apt-get update
$ sudo apt-get install build-essential manpages-devCopy
For CentOS, Fedora, Red Hat and Scientific Linux:
# yum groupinstall 'Development Tools'
Copy
It will install GNU GCC and its related tools on your system.
Use the following command to verify if the GCC compiler is installed.
$ gcc --versionCopy
Save your favorite text editor and save a file with .c extension. Here we have saved the file named hello.c using gEdit.

C code in gEdit text editor
You can use any editor such as vim, emacs etc. on your Linux system. Any editor is good, but do not miss the .c extension. Because it is very important.
Go to the directory where the file is located and give the following commands.
$ gcc program-source-code.c -o name-of-your-choiceCopy
Here program-source.code.c is the name of your first name and name-of-your-choice, any name you like. We've used $ gcc hello.c -o hello command here.
If there is no error, an executable file will be created; In our case hello name file was created
Finally you can see the output using the following command.
$ ./hello
Copy
Run C programming in Windows
Download Code :: Blocks software for running C Programming in Windows. Then type c code and save it to the file with .c extension and execute the code.
To make this method even easier, follow the steps below.
Code Block Official site binary release, download page of Code: Blocks.
Click the mingw-setup link from Sourceforge.net or FossHub under the Windows XP / Vista / 7 / 8.x / 10 section.

Download Code :: Blocks in Windows
Open the code :: Blocks Setup file and select Next> I agree> Next> Install Instructions. You do not need to change anything here. Because the gnu gcc compiler is installed by default with Code :: Blocks. Which is the best compiler for beginners.
Now open Code :: Blocks and go to File> New> Empty file (shortcut: Ctrl + Shift + N).

Create blank file in Codeblocks
Save code by typing the code and typing the .c extension. To saveGo to File> Save (shortcut: Ctrl + S).
Note: File name ends with .c extension such as hello.c, my-program-name.c

Create file with .c extension in Codeblocks to run C programming
To run the program, go to Build> Build and Run (shortcut: F9). It will build and run executable files.
If your program does not run and if the error message "can not find compiler executable in your search path (GNU GCC compiler)", then go to Settings> Compiler> Toolchain executables and click Auto-detect. In most cases, such problems are solved in this manner.

0 Comments