How to install GCC

Started by
2 comments, last by This is no one 10 years, 3 months ago

I just got a new book about C and I am excited to learn the language that is used in most games, but the book says I need to install GCC. I found the GCC website, but it doesn't seem to have any download link anywhere. The only link it has leads to cygwin.com, and I don't see how that is related to C. Can anyone give me the link to download GCC for windows?

My CVMy money management app: ELFSHMy game about shooting triangles: Lazer of Death
Advertisement
Cygwin and MinGW are both attempts at providing GCC plus standard libraries and build environments for Windows. Cygwin attempts to provide a POSIX environment, whereas MinGW does not. You can get modern builds of MinGW (which seems be more widely used than Cygwin these days) from the Mingw-w64 project.

Additionally, despite what the book says, you don't need to install GCC to use C/C++ on Windows. Microsoft provides their own solution in Visual Studio (link is to the free Express version.)

One final addendum: C is hardly used in games anymore; it tends to be the language of the lower-level kernel hackers. C++, however, is still widely used. C# also is making a strong showing, and if you go that route then Visual Studio is a good choice as it supports both C++ and C#.

I personally like MinGW, which as JTippet says, is (among other things) the equivalent of GCC for Windows.

However, you'll probably want an IDE to go with that compiler. The free QtCreator comes with MinGW packaged with it and setup for you.

You'd go here, and download "Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB)". (but read the rest of this post first)

This will provide you with a fully-function IDE*, a very recent version of MinGW**, and Qt***.

It's all set up for C++, but you can use it (and limit yourself) to basic 'C' if you want to. C++ is what is used most for games, but reading through your book will still be useful to you - if it's an old book (written before 2003) it might be hard to learn - things have changed somewhat since then. Learning to program is a multi-year journey, so whatever you do, don't get discouraged, but realize in advance there will be plenty of obstacles that are very frustrating, and that those obstacles need to be overcome one by one as they appear.

Or you can download Visual Studio, like JTippets suggested, which is probably the better option! Note: By "Express version" of Visual Studio, that doesn't mean it's limited or useless or slimmed down. It's fully functional with everything you need - including if you later want to sell your programs commercially. There are a few things removed from it, but nothing that'll bother you for the first year or two of your programming journey, and you can cross that bridge (or find another bridge) when you get there. You don't have to pay for the advanced version, the free version is perfectly fine and isn't crippled. Hundreds of thousands of programmers use the Express version perfectly happily, and they are skilled programmers.

Half of programming is problem solving. The other half is crying in a corner because the problem wasn't as solved as you originally thought. laugh.png

Okay, so it's not that bad, but there are plenty of difficulties that'll be unique to your journey that you'll have to just be stubborn enough to head-butt through when they appear - consider this the first challenge you encountered in the wild. smile.png

What's that moving in the grass? A wild programming challenge appeared!

* An IDE is like a Microsoft Word type of program with fancy features, except you write computer code in it instead of documents. It's a fancy text editor designed for code with programming-specific things built into it.

** MinGW is, as mentioned, a port of GCC (and some other stuff) to Windows. You can go ahead and pretend that MinGW is GCC for Windows, even if that's not 100% accurate in a technical sense.

*** Qt is a huge set of C++ libraries that let you make non-gaming programs with normal Windows buttons and file menus and stuff like that. You can just ignore it until you learn C++.

MinGW and MinGW-w64 are both mighty fine compilers which differ mainly in their implementations of the CRT and in support of newer features. MinGW-w64 has a much more up-to-date and complete API and is much more aggressively developed. The original MinGW, on the other hand, is more mature, and has a rather "conservative, safe" approach. You may find that one or the other new function isn't in the API, but usually you will not notice anything missing.

Note that MinGW-w64 is not necessarily only able to produce 64bit executables for 64bit Windows, even if the name may lead you to believe that. It produces 32-bit executables just fine (there exist 32bit-only builds and builds that can do both 32 and 64, depending on what commandline option you give to it).

The hardest bit is probably choosing which one to use, since there are so many versions and builds. It's a bit like being in a candy shop rolleyes.gif

I would recommend a 32bit-only gcc-4.8 build with SJLJ exceptions to start with (for example the TDM32 package). The generated executables run on any system, there's not much you can do wrong, and you do not have any obscure problems lurking (such as with DW2 exceptions). Version 4.8 has a good support of C++11 and is reasonably stable and bug-free. The generated code is up to par with the best available compilers.

Cygwin is something I wouldn't recommend, for two reasons. The less important reason is that it doesn't do what most people want. Most people actually don't want a complete POSIX emulation layer on top of Win32 (even more so as some things like fork do not map to Windows well at all!). The more important reason is, however, that the standard libraries you link with are under the GPL. Which means that any programs you write are necessarily under the GPL too. Free software is great, and if you never intend to write anything but free software, being bound to the GPL is no problem -- but most people will eventually discover that they have to eat and pay bills, too.

Using MinGW, on the other hand, the compiler is under the GPL (as well as the profiling lib), but the executables that come out are licensed any way you want. The standard library is technically under the GPL too, but there is a license clause that exempts you from the obligations.

I just got a new book about C and I am excited to learn the language that is used in most games, but the book says I need to install GCC. I found the GCC website, but it doesn't seem to have any download link anywhere. The only link it has leads to cygwin.com, and I don't see how that is related to C. Can anyone give me the link to download GCC for windows?


I am happy to see you have found a strong interest in learning a new language.

One final addendum: C is hardly used in games anymore; it tends to be the language of the lower-level kernel hackers. C++, however, is still widely used. C# also is making a strong showing, and if you go that route then Visual Studio is a good choice as it supports both C++ and C#.


What JTippetts says is true. However, I feel it is still important to learn the C programming language as it gives you an appreciation, if not a better understanding of what goes on in higher level languages like C++ and C#. Also, by understanding the differences between a low, mid and high level language, you have the needed awareness of what to be cautious about in programming high level applications (such as some games). C++ is, in my opinion, one of the most powerful languages around. This is essentially because C++ can be used in a C like low level paradigms or in a C# like high level paradigm. But with that power, comes the dangerous practice of mixing a low level and high level paradigm in a single application. This should be avoided. Not knowing the difference could get you in a lot of trouble, which recaps why I feel you should learn C.

Also, remember that since C++ is backwards compatible to C, you could simply install a C++ compiler, its libraries, and an IDE to support it while still learn C through use of it.

Or you can download Visual Studio, like JTippets suggested, which is probably the better option! Note: By "Express version" of Visual Studio, that doesn't mean it's limited or useless or slimmed down. It's fully functional with everything you need - including if you later want to sell your programs commercially.


What Servant of the Lord refers to is also correct and vitally important. As novice programmers, many people tend to not realize the vital importance of understanding the complexity behind copy right laws, and where copy left laws associate. It is important to understand the clear definition of what GNU means, and how it applies to anything you create. For more reading, see here: http://en.wikipedia.org/wiki/GNU_General_Public_License

Now, all methods of setting up your IDE listed from Servant of the Lord and JTippetts are correct and are very useful. But both methods will also come with the proprietary development of Windows programming (some exceptions with Qt and Cygwin). Assuming that you one day wish to expand to other operating systems, another option for you is to use the Eclipse IDE. For right now, I would avoid using it in Windows as it requires some greater knowledge in configuring it with a C++ compiler. However, when you do feel ready, it can be setup to use MinGW, Cygwin, Linux/UNIX or the same compiler used by Visual Studios! And because Eclipse is not GNU licensed, you could also program on a Mac and still sell the game!

If you want to get a feel for how it works in a different OS environment, you could do it by simply following the below steps:

1.Download/Install the Oracle VM here: https://www.virtualbox.org/

2.Download CentOS here: http://www.centos.org/

3.Run Oracle VM and install the CentOS in a virtual environment. Here's a tutorial on installing CentOS:

http://www.tecmint.com/centos-6-3-step-by-step-installation-guide-with-screenshots/

NOTE: When installing CentOS, choose the prepackage option (step 19 on the tutorial) of a Software Development Workstation.

4.Run the OS, Log in, and start the Eclipse IDE (The Linux C/C++ compiler is already configured for you).

5.Follow the steps normally taken in creating a C++ project, and start coding away.

NOTE: 3D programming may require additional Linux RPMs and may not run properly in a VM environment. Additionally, 3D programming frameworks associating to DirectX and Direct3D will not work on Linux without WINE bindings. Finally, when you develop using Eclipse on a Mac, you'll be using a different compiler, which may require a manual configuration in the Eclipse IDE.

To make full use of my recommendation, learn how to use preprocessor directives, and make your code very efficient for cross-platform execution (an advantage of learning C). The preprocessor directives can judgement whether to use Direct3D or OpenGL based on which compiler is detected. In essence, a solid application will only need to be compiled multiple times between different compilers generating multiple executables. Thus, all you would do is create a script that decides which executable to run based on which operating system is detected and you have a cross-platform package with multiple executable that were compiled with absolutely no coding differences.

This topic is closed to new replies.

Advertisement