GCC Compiler for Windows

The acronym GCC is familiar to many people who are involved in software development. This compiler is a tool for free software developers. Initially, this tool was created for Linux-systems. But there is also a GCC implementation for Windows. It is called MinGW.

History

gcc for windows

The tools that are traditionally used to develop programs for open operating systems are GNU tools. A project with this name was created by Richard Stallman in 1984. Its necessity was caused by the fact that in those days cooperation between program developers was difficult. This happened due to the fact that the owners of commercial programs posed many obstacles to such cooperation. The goal of the project was to create a set of software, united by one license, which would not allow someone to assign exclusive rights to such software. It is part of this set that the GCC tool is for programmers. For Windows, an analogue was created later.

What is a compiler?

It is worth explaining what kind of software this is. What is it for? In general, the GCC compiler for Windows or Linux is a program that can convert source code written by a programmer into machine code that a computer can understand. There is such a thing as an β€œinterpreter”. Its functions are the same as those of the compiler, but it performs the translation line by line, and not in its entirety. In this case, the program is converted to bytecode - an intermediate form, which is binary code. It is then interpreted at runtime by a special virtual machine.

Development

gcc compiler for windows

Files containing source codes are created as plain text documents. They can be created using any simple text editor. In addition, you can use special development environments in which editors are built. This tool is KDevelop. This is an environment containing both an editor and an integrated console, which is located under the editor. The developer gets the opportunity in one program to both engage in code editing and give console commands without switching between windows.

Before creating a project, you need to create a directory, and in it already - a text document.

Features

gcc arm windows

GCC for Windows MinGW assigns by default to all executable files that are created, the name is a.out. If you need to give a different name, you need to add the -o flag with the name to the compilation command. This is just one of many flags. In order to see everything, you need to type man gcc at the command prompt. For Windows, the command is the same as on the Linux system. A compiler help system will appear in front of the user. Here you can see what each flag means. To exit the help system, press the Q key.

The work of GCC includes three stages:

  • preprocessor processing;
  • compilation;
  • layout.

At the first stage, the contents of the header files, which are specified in the directives at the beginning of the program, are included in the main file.

At the second stage, the text of the program written in the programming language turns into a set of machine instructions, and the result is saved in an object file. It is worth noting that on different computers the format of this file may be different. That is why it is more convenient to distribute programs in the form of source code so that they can be accessed by any architecture. This is exactly what GCC does. ARM, Windows, Intel, Unix - programs are able to run everywhere.

At the last stage, all object files are linked into one. The result is a startup file.

Thus, GCC is a convenient tool for developers who are comfortable using when creating programs.


All Articles