GCC for Windows development environment Introduction

Source: Internet
Author: User

Guide:
   GCC under the Windows operating system
   Section I. GCC Family Overview
GCC is a compiler that was originally programmed for unix-like systems.
But now GCC also has a lot of Win32 under the transplant version number. So, perhaps, for many Windows developers, GCC is a relatively unfamiliar thing. So, I hope that through the narrative of this chapter, you--a Windows developer has a general understanding of GCC, an excellent compiler.
   History
GCC is a project of the GNU commune. is a free compiler for programming development. Initially, GCC was just a C compiler, and he was the abbreviation for GNU C Compiler. With the addition of many free developers and the development of GCC itself, today's GCC is a compiler that includes many languages. These include C,c++,ada,object C and Java. Therefore, GCC also changed from the original GNU C Compiler to the GNU Compiler Collection. That's what the GNU compiler family means. Of course, today's GCC has the ability to cross-compiler with the help of his features, that is, to compile a platform with a platform code.
Until now, the history of GCC continues, and his legend is still known.
   Windows under the GCC Family
Initially, GCC was the compiler for the unix,unix-like system. Just now there is a stable ported version of GCC under Windows. This is thanks to the concerted efforts of many of the program apes on the Internet.
Today, there are three of the most popular GCC porting versions under Windows. They are Mingw,cygwin and DJGPP. Although DJGPP is applied to DOS systems, the DJGPP is also included, considering the compatibility of Windows with DOS.
On the whole, Mingw,cygwin and DJGPP have their own characteristics, for different applications, can choose different transplant version to meet the needs. MinGW This series of porting, the main direction is to let GCC's windows transplant version can use WIN32API to program. The goal of Cygwin is to allow the program code under Unix-like to be compiled directly under Windows. As for DJGPP, you want to make it possible for DOS to use GCC as well.
So, for different needs of developers. Choosing the right transplant will make your work easier and more efficient.
   of this book GCC
I personally like the transplant version of GCC very much. Whether it is mingw or Cygwin, or DJGPP. In this book, in addition to the special instructions, the content is suitable for all of the three transplant versions.
It's just that, given that the MinGW series is now used more in Windows. Plus MinGW is easier to install and use than Cygwin and DJGPP. Therefore, it is recommended that readers use MinGW when learning.
   the second section of the Romans MinGW
   Simple Introduction
MinGW is the minimalistic GNU for Windows abbreviation. She is a compiler system built on GCC and binutils projects. Compared to other GCC transplant versions, she was able to say the closest to Win32. As a result, MinGW almost supported all the WIN32API, which is one of MinGW's characteristics. The program that she connects to does not need to be able to execute any third-party libraries. To some extent, MinGW is more like a substitute for VC.
   Get and install
MinGW can be obtained from MinGW's official site http://www.mingw.org.
Assuming that you want to install MinGW, then you have two installation scenarios. Let me introduce the following.
Installation Scenario One:
First of all, you need to download from Http://www.mingw.org/download.shtml for example the following several compressed packages. Take into account the file updates and the flexibility of the article. I'll just write out the main part of the file, which will save the version number and update date.
Gcc-core C language Compiler
Gcc-c++ C + + language compiler
Mingw-runtime MinGW Execution Time library (this must be installed)
Win32API Win32 API function header file and connection library
Binutils MinGW-based tools such as assemblers and connectors
Debugging tools in GdB MinGW
Mingw32-make make tool for better management of your project
Then, download each of the above files and then extract them all to a folder, and I'm assuming that you are moving to the $ (MINGW) folder. This way, your MinGW is installed successfully.
Finally, on the DOS terminal, convert the current folder to $ (MINGW)/bin. Input
C:/>gcc-v
See the GCC version number information, which shows that your GCC is working properly.
Installation Scenario Two:
You can download Mingw5.0.2.exe this program from http://www.mingw.org/download.shtml. At least, when I write this, this is the latest version number.
After downloading to perform the installation, as for the installation process, I think I will not introduce each. For developers under windows, I don't think this is going to be a problem.
After everything has been chosen well. The program starts by downloading the required compression packets from the Internet. Then, untie each, install.
On the whole, both approaches are beneficial. Just, I prefer the first method. Because of the high degree of control, it is also easier to update. My heart is also more clear.
   Environment settings:
For us these users, it is best to use the tool easily and conveniently. Therefore, we need to set up the environment, so that we can use MinGW.
For the setting, we just need to add $ (MINGW)/bin to the PATH variable in the environment variable.
This way, you'll be able to use MinGW in whatever folder you like.
   The third section of the people in Cao Camp Heart in Han Cygwin
   Introduction
Cygwin, in fact, is not a gcc. She is the software that lets windows have a unix-like environment. So, GCC will naturally be included in it. Just for developers, Cygwin is a development environment. For users, Cygwin is an execution environment.
The biggest difference between Cygwin and MinGW is the ability to use Cygwin to downgrade the unix-like system functions in Windows. For example, process functions, and so on. So, although Cygwin is executed under Windows, she still uses the functions and ideas of the unix-like system.
   Get and install
Cygwin is able to get the installer from Cygwin's official site http://www.cygwin.com/
Download the Cygwin installer setup.exe on the site. Then you can do it.
As for the previous setting, I don't want to introduce more. Because, for these I think the developer under Windows should be pretty clear.
When you have selected the components to install, under the Devel option, click on the gcc-core,gcc-g++ before and after the skip to the version number you need.
Then, in the Lib tab, set the skip point before glib2,glib2-devel,glib2-runtime to the version number.
Next, just click on next to be able to. After a long wait time, your Cygwin development environment is ready to install.
The Cygwin is relatively simple to install and configure. As a result, Cygwin provides a more robust installation program.
   Use
Under the installation folder, execute Cygwin.bat to start the Cygwin environment. This is a simulated Linux environment, so there may be a lot of places and DOS have a relatively large gap. Only the programs you compile can be executed directly on other machines that do not have Cygwin installed. Also, suppose you want to switch to a different disk under Windows, such as D-Disk. Then you can use
$CD/cygdrive/d/
You can go to the Linux community to get a reference for a lot of other things about using Cygwin.
   The fourth section of the two-foot-only boat DJGPP
   Introduction
DJGPP, is a GCC transplant version number under pure DOS. She uses some software to set the pure DOS into a 32-bit environment and execute the program that she compiled. Overall, DJGPP is not a ported version of Windows. Just, she can actually execute under Windows. For some special applications. DJGPP is the only fit.
   Get and install
DJGPP, can be downloaded from DJGPP's official site http://www.delorie.com/djgpp/
Just, here DJGPP for the user to make a much better arrangement. She provides users with a custom-installed page.
Http://www.delorie.com/djgpp/zip-picker.html
You only need to fill in the content of the response above and submit it. She will give you a complete installation plan.
   Use
Relatively speaking, djgpp I do not often use. Therefore, the DJGPP is not used in this article without special instructions.
   text tone:
Overall, this article was written in a hurry. So there may be some places that are inadequate. Therefore, I hope that you can forgive criticism and generous comments. In the next chapter, I'll cover the IDE for the GCC for Win32. At the same time, from the beginning of this chapter, I will make a small request to the readers. That is, I hope you can tell me the inadequacy of this article, I will always change the content to be published to suit the needs of the vast number of readers. Suppose you have any ideas or opinions, doubts.
trackback:http://tb.blog.csdn.net/trackback.aspx?postid=1819084

This article turns from
Http://blog.csdn.net/Mobidogs/archive/2007/10/10/1819084.aspx

GCC for Windows development environment Introduction

Related Article

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.