Cygwin: Free C++ for Windows

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Pssst… Want a Free C++ Compiler?

Is there such a thing as a free C++ compiler for Windows? In fact, there are several. For example, Microsoft recently released their Visual C++ Toolkit 2003, which gets you a bare-bones compiler.

But, another possibility exists, from an unlikely source, and it has the added attraction that when you learn to use it, you are learning to use the same software that you would find in a typical Linux installation. Even if you’re a dyed-in-the-wool Windows user (which I’m afraid I am), this has to be worth investigating.

Linux can be quite overwhelming when you first install it, which makes it hard to learn anything about it. To a Windows user, everything is different and strange. It would be better to be able to play with some pieces of it, without having to leave the safe, familiar surroundings of Windows just yet.

So, if you want to learn C++ for free, and get some understanding of how to use a UNIX-like environment (without having to find the Linux driver for your DSL modem), read on.

Linux and GNU

The vast majority of the software on a Linux CD-ROM set is not specifically anything to do with Linux. It’s GNU software, distributed freely as source code, that can be run on any UNIX-like operating system, and in fact it provides all the pieces of a typical UNIX operating system—at least, the parts you interact with directly, such as shells, editors, and development tools.

Cygwin

The good news for us Windows users is that if you visit http://www.cygwin.com, you will find a convenient bundle of this software ready to download and install all in one step. If you have a decent connection, be sure to ask the installer to give you everything—it’s a huge download, but it gives you a vast and very complete UNIX-like environment to play with.

It puts a shortcut on your desktop to open the BASH shell, which is a version of the Bourne shell, the original “interactive” user interface of UNIX. Bourne himself wrote a beautifully clear and helfpful introduction to it, way back when.

The shell is really just the same thing as the Windows command prompt. Just as Windows has batch files that are just lists of commands, a UNIX shell has scripts (although shell scripts have somewhat better looping and control features than batch files.)

All UNIX operating systems have a version of the Bourne shell, but they usually aren’t as good as BASH, and so most people get a version of BASH for their UNIX flavour and use it instead of the default shell.

Now, you have Cygwin, and you feel just about ready to start hacking the Linux kernel. So, where is this C++ compiler?

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read