Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a novice programmer and have been experimenting with Javascript, jQuery and PHP but felt I wasn't getting a real depth of understanding of what I was doing. So, after reading Joel Spolsky's response to a question on this site (which I can't find now!), I took it back to basics and read Charles Petzold's 'Code' and am about to move onto Kernighan and Richie's The C Programming Language. I want to learn this in a UNIX environment but only have access to a Windows system. I have Ubuntu 12.04 running on a virtualised machine via VMWare Player, and done some coding in the terminal.

Is using a Linux distro the only option for programming in a UNIX environment on Windows? And what are the next steps to start programming in C in UNIX and where do I get a compiler from?

share|improve this question
If you are learning standard C and nothing but the standard, then it really doesn't matter if you use Windows or Linux. The biggest difference is that Linux sort of uses GCC by default. But if you are a fan of GCC, the MinGW compiler is an excellent option for Windows. –  user29079 Sep 27 '12 at 14:26
add comment

3 Answers

up vote 9 down vote accepted

Linux in VM is the easiest option to learn UNIX. If you're running Ubuntu, you can open up terminal and type:

sudo apt-get install gcc

And you'll have your compiler. Debian-based distros in general will make development very easy because if you're missing library X, chances are it's already in the repositories and you can apt-get it with minimum fuss.

For the other part of your question: no, Linux in VM is not the only way to go, but it's the easiest to get started with. You can always intall FreeBSD / Open Solaris / etc but I don't recommend those for your first plunge.

Finally, if you want to force yourself to learn the system, you can install it on bare metal and ditch the VM. I recommend dual-booting to start. You will probably start running into driver / configuration problems :) and ultimately have to learn how everything works.

Good luck.


In reference to some comments: MinGW and Cygwin will not help the OP learn UNIX/POSIX. The OP clearly stated that she/he is interested in C programming in UNIX, and that means UNIX-specific APIs, patterns, and issues.

share|improve this answer
MinGW-w64 includes a wrapper implementation of pthreads, and there's always Pthreads Win32. Also there's support for pthreads via Microsoft Windows Services for UNIX. –  Yannis Rizos Sep 26 '12 at 15:55
@YannisRizos Here's what the OP said: "start programming in C in UNIX". You can program your entire life without pthreads. You can also use wrappers. But if you want to learn UNIX and how to program for it in C, then you should probably use UNIX and program for it in C. It's like saying "I want to learn to drive manual gearbox by simulating it on an auto" - might even be possible, but not the best way to go. –  MrFox Sep 26 '12 at 16:01
@YannisRizos that being said you have a point about wrappers and I changed my answer. –  MrFox Sep 26 '12 at 16:03
I'm not arguing with you, just noting that it's not impossible to have (at least bearable) support for pthreads on Windows. A POSIX standard system would be an optimal system to learn C on (and do almost anything, really), but what I got from the question is that they prefer to stay with Windows, thus I focused my answer on Windows. –  Yannis Rizos Sep 26 '12 at 16:06
add comment

If you really don't want to move to Linux, or continue using Linux on a virtual machine, you could give Cygwin a try. It's:

  • a collection of tools which provide a Linux look and feel environment for Windows.

  • a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.

More importantly, it makes The GNU Compiler Collection available on Windows. A similar tool, but a bit more tuned for developers is MinGW. It includes:

  • A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
  • GNU Binutils for Windows (assembler, linker, archive manager)
  • A command-line installer (mingw-get) for MinGW and MSYS deployment on MS-Windows
  • A GUI wrapper (mingw-get-inst) for the command line installer

Everything you need, and then some.

share|improve this answer
GCC is available without Cygwin, via MinGW. –  delnan Sep 26 '12 at 15:39
@delnan I was just about to update the answer to mention MinGW. –  Yannis Rizos Sep 26 '12 at 15:39
Great, carry on then :) –  delnan Sep 26 '12 at 15:40
@delnan I had completely forgotten MinGW's name, one of these "I know there's something out there that does this, and I've used it few times, what the hell was its name?" moments. I googled windows gcc and facepalmed myself when I saw the first result. Your comment appeared a fraction of a second later, only to add to my shame ;) –  Yannis Rizos Sep 26 '12 at 15:45
add comment

OSX since 10.5 and forward is offically considered a Unix. Solaris is another option. Either one can be installed on Virtual Box, both include GCC as a compiler. Ignore cygwin under Windows, it is more trouble than it is worth, and isn't a full Unix environment/experience.

I use Virtual Box on both an OSX machine and a Windows machine to host Linux ( CentOS ) and with a dual monitor setup and plenty of RAM you don't even realize that it is not a real machine you are using.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.