Introduction to the GCC for Win32 Development Environment (1)

Source: Internet
Author: User

GCC for Win32Development Environment(1)

Chapter 1Gcc

Section 1GccFamily Overview

GCC is a compiler originally used for programming in Unix-like systems. However, GCC also has many Win32 versions. Therefore, GCC may be a strange thing for many windows developers. Therefore, I hope that this chapter will give you a general understanding of GCC, a Windows developer.

History

GCC is a project of the GNU community. Is a free compiler for programming and development. Initially, GCC was just a C language compiler, short for gnu c compiler. With the addition of many free developers and the Development of GCC itself, GCC is now a compiler that contains many languages. These include C, C ++, Ada, Object C, and Java. Therefore, GCC also changed from gnu c compiler to GNU Compiler Collection. That is, the meaning of the GNU Compiler family. Of course, with the help of its features, GCC now has the cross compiler function, that is, to compile the code of another platform on one platform.

Till now, the history of GCC continues, and his legends are still praised.

Windows Under Gcc Family

At first, GCC was used as a compiler for UNIX and Unix-like systems. However, the GCC stable porting version is also available in windows. Thanks to the joint efforts of many programmers on the Internet.

Currently, there are three popular GCC moderators in windows. They are mingw, cygwin and djgpp. Although djgpp is applied to the DOS system, djgpp is also incorporated into it considering Windows's compatibility with DOS.

In general, mingw, cygwin, and djgpp have their own characteristics. For different application scenarios, you can choose different porting versions to meet your needs. The main direction of mingw series migration is to enable the Windows porting version of GCC to use WIN32API for programming. Cygwin aims to enable the program code under Unix-like to be directly compiled in windows. As for djgpp, it is intended that GCC can be used in DOS. Therefore, developers have different needs. Selecting the appropriate porting version will make your work easy and efficient.

Of this book Gcc

I personally like the GCC porting version very much. Whether it is mingw, cygwin, or djgpp. In this book, except for special instructions, the content described here is suitable for all three portable versions. However, the mingw series is widely used in windows. In addition, mingw is easier to install and use than cygwin and djgpp. Therefore, it is recommended that you use mingw for learning.

Section 2Mingw

Introduction

Mingw is short for minimalistic GNU for Windows. She is a compiler system built on GCC and binutils projects. Compared with other GCC versions, she is the closest to Win32. Mingw supports almost all win32apis, which is also one of the characteristics of mingw. The program connected to her can run without any third-party libraries. To some extent, mingw is more like a replacement of VC.

Obtain and install

Mingw can be obtained from mingw's official website http://www.mingw.org.

If you want to install mingw, you have two installation solutions. I will introduce them one by one.

Installation Method 1:

First, you need to download the following packages from the http://www.mingw.org/download.shtml. Take into account file updates and document flexibility. I will write only the main parts of the file, saving the time for versioning and updating.

Gcc-core C language compiler
Gcc-C ++ C ++ Compiler
Mingw-runtime Mingw Runtime Library (this must be installed)

WIN32API

Win32 API function header file and Connection Library

Binutils

Basic tools such as mingw Assembler and connector

GDB

Debugging tools in mingw
Mingw32-make Make tool for better management of your project

Then, download the above files one by one and decompress them all to a directory. Here I assume you are moving to the $ (mingw) directory. In this way, your mingw is successfully installed.

Finally, go to the DOS terminal and convert the current directory to $ (mingw)/bin. Input

C:/> gcc-V

If you see a piece of GCC version information, it indicates that your GCC is working properly.

Installation solution 2:

You can download mingw5.0.2.exe from the http://www.mingw.org/download.shtml. At least, this is the latest version when I write this article.

After the download, run the installation. As for the installation process, I will not describe it one by one. For developers in windows, I think this is not a problem. After everything is selected. This program starts to download the required compressed package from the Internet. Then, unlock and install them one by one.

In general, the two methods have their own strengths. However, I prefer the first method. Because of its high control and easy update. You are also clear in your mind.

Environment Settings:

For our users, it is best to use simple and convenient tools. Therefore, we need to set up the environment so that we can use mingw.

For setting, you only need to add the $ (mingw)/bin path to the PATH variable in the environment variable.

In this way, you can use mingw in any directory.

Section 3 people in Cao Ying's heart in HanCygwin

Introduction

Cygwin is not a GCC. She is a software that enables Windows to have a Unix-like environment. Therefore, GCC will naturally be included. However, for developers, cygwin is a development environment. For users, cygwin is a running environment. The only difference between cygwin and mingw is that cygwin can call Unix-like system functions in windows. Such as process functions. Therefore, although cygwin runs on Windows, she still uses UNIX-like system functions and ideas.

Obtain and install

Cygwin can get the installer http://www.cygwin.com from cygwin's official website/

Download the cygwininstaller setup.exe on the website. Then you can run it. I don't want to talk about the previous settings. Because, for these, I think windows developers should be quite clear.

When selecting the component to be installed, under the devel option, click the skip before gcc-core and GCC-G ++ to the version number you need.

Then in the Lib tab, point glib2, glib2-devel, the skip before the glib2-runtime to the version number.

Next, click Next. After a long wait, your cygwin development environment is installed. The installation and configuration of cygwin are relatively simple. Because cygwin provides a sound installer.

Use

Run cygwin. bat in the installation directory to start the cygwin environment. This is a simulated Linux environment, so there may be a big gap with DOS in many places. However, the program you compiled can run directly on other machines without cygwin installed. Also, if you want to switch to another disk in windows, such as disk D. Then you can use

$ CD/cygdrive/D/

For more information about cygwin, visit the Linux community.

Section 4: two ships on footDjgpp

Introduction

Djgpp is a GCC porting version under pure dos. She uses some software to set pure DOS to a 32-bit environment and run the program compiled by her. In general, djgpp is not a Windows transplant version. However, she can indeed run in windows. For some special applications. Djgpp is the only fit.

Obtain and install

Djgpp, can download http://www.delorie.com/djgpp/ from djgpp's official website

However, djgpp has made more arrangements for users. She provides users with a custom installation page. Http://www.delorie.com/djgpp/zip-picker.htmlyou only need to fill in the response content in the response, and then hand it over. She will provide you with a complete installation solution.

Use

Relatively speaking, djgpp is not frequently used. Therefore, this document does not use djgpp unless otherwise specified.

VOICEOVER:

In general, this article was written in a hurry. Therefore, there may be deficiencies in some areas. Therefore, I hope you will forgive criticism and suggestions. In the next chapter, I will introduce the GCC for Win32 IDE. At the same time, from this chapter, I will make a small requirement for readers. That is, I hope you can tell me what you feel about this article. I will modify and post the content at any time to suit the requirements of readers. If you have any thoughts or comments, you may be confused. Hope you can submit it on http://blog.csdn.net/visioncat.

Studio software development group (SDT)
Studio development team
Dipper (Huang yaokui)

Index: GCC, windows, mingw, cygwin, djgpp, introduction, installation, configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.